Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional resource attributes for browser #3287

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions semantic_conventions/resource/browser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,34 @@ groups:
to retrieve brands and platform individually from the User-Agent Client Hints API.
To retrieve the value, the legacy `navigator.userAgent` API can be used.
examples: ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36']
- id: visitor_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in the RUM Sig this morning, to avoid possible duplication between client runtimes (browser, android, IOS, IOT, etc) perhaps these should be defined with a more generic namespace.

Perhaps: client (need to check if there is an ECS equivalent to avoid possible name clashes if/when ECS merges)

Additionally, as several of these are defined as varying values within a single execution resources may also not be the best location for these types.

@tedsuo do you have any thoughts on where to define semantic conventions for mutable resource values (ie. Ephemeral Resource type Attributes )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I raised a separate issue #3351 seeking guidance on a common namespace for browser and mobile.

type: string
brief: An anonymous id for the visiting user.
note: >
This will remain same in a given browser session, and will persist
across page navigations in the same browser session.
examples: ["123"]
- id: session_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the correct location / name for this value as the session id could be used for more than the browser.

Additionally, as a varying attribute I'm not sure that this is location -- but I don't know where this belongs.

type: string
brief: Identifier for the current browser session
examples: ["123"]
- id: page_impression_id
type: string
brief: Unique id for the page impression, represented by a GUID
note: >
As an example, Page.html will yield 4 impression ids if the page is
refreshed 4 times in the same browser instance. For SPA apps, every
URL change results in a new impression.
examples: ["12627cc493-f310-47de-96bd-71410b7dec043"]
- id: screen_width
type: int
brief: Screen width of the device/browser view port
examples: [600]
- id: screen_height
type: int
brief: Screen height of the device/browser view port
examples: [400]
- id: url
type: string
brief: Complete URL of the current active page including the URL fragment
examples: ["https://en.wikipedia.org/wiki/Main_Page#foo"]
14 changes: 12 additions & 2 deletions specification/resource/semantic_conventions/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ All of these attributes can be provided by the user agent itself in the form of
| `browser.platform` | string | The platform on which the browser is running [2] | `Windows`; `macOS`; `Android` | Recommended |
| `browser.mobile` | boolean | A boolean that is true if the browser is running on a mobile device [3] | | Recommended |
| `browser.language` | string | Preferred language of the user using the browser [4] | `en`; `en-US`; `fr`; `fr-FR` | Recommended |
| `user_agent.original` | string | Full user-agent string provided by the browser [5] | `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36` | Recommended |
| `browser.visitor_id` | string | An anonymous id for the visiting user. [5] | `123` | Recommended |
| `browser.session_id` | string | Identifier for the current browser session | `123` | Recommended |
| `browser.page_impression_id` | string | Unique id for the page impression, represented by a GUID [6] | `12627cc493-f310-47de-96bd-71410b7dec043` | Recommended |
| `browser.screen_width` | int | Screen width of the device/browser view port | `600` | Recommended |
| `browser.screen_height` | int | Screen height of the device/browser view port | `400` | Recommended |
| `browser.url` | string | Complete URL of the current active page including the URL fragment | `https://en.wikipedia.org/wiki/Main_Page#foo` | Recommended |
| `user_agent.original` | string | Full user-agent string provided by the browser [7] | `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36` | Recommended |

**[1]:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.brands`).

Expand All @@ -26,5 +32,9 @@ The list of possible values is defined in the [W3C User-Agent Client Hints speci

**[4]:** This value is intended to be taken from the Navigator API `navigator.language`.

**[5]:** The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used.
**[5]:** This will remain same in a given browser session, and will persist across page navigations in the same browser session.

**[6]:** As an example, Page.html will yield 4 impression ids if the page is refreshed 4 times in the same browser instance. For SPA apps, every URL change results in a new impression.

**[7]:** The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used.
<!-- endsemconv -->