Skip to content
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
22 changes: 22 additions & 0 deletions .chloggen/browser_user_action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: new_component

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: browser

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `browser.user_action` event.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [1941]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
49 changes: 49 additions & 0 deletions docs/browser/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,53 @@ semantic convention tooling supports complex attributes
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## UserAction Event

<!-- semconv event.browser.user_action -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

**Status:** ![Development](https://img.shields.io/badge/-development-blue)

The event name MUST be `browser.user_action`.

This event describes actions performed by the user such as click, scroll, zoom, resize, etc.

**Body fields:**

:warning: Body fields will be moved to complex attributes once the
semantic convention tooling supports complex attributes
(see [#1870](https://github.com/open-telemetry/semantic-conventions/issues/1870)).

| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| `page.x` | int | Click x(horizontal) coordinates(in pixels) relative to the entire document. | `10` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `page.y` | int | Click y(vertical) coordinates(in pixels) relative to the entire document. | `10` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `tag_name` | string | Target element tag name and it is obtained via `event.target.tagName`. | `BUTTON` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `tags` | string[] | Grab data from data-otel-* attributes in tree. | `["id", "name"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `type` | enum | Type of interaction. See enum [here](https://github.com/microsoft/ApplicationInsights-JS/blob/main/extensions/applicationinsights-clickanalytics-js/src/Enums.ts) for potential values we could add support for. | `click.right` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| `xpath` | string | Target element xpath by using [XPathExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression). see [xpath](https://www.w3.org/TR/xpath/). | `//*[@id='testBtn']` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |

`type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `click.left` | An element is left clicked by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `click.middle` | An element is middle clicked by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `click.right` | An element is right clicked by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `keyboard.enter` | An element is entered via keyboard by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `keyboard.space` | A space is entered via keyboard by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | User actions that are not listed above. | ![Development](https://img.shields.io/badge/-development-blue) |
| `resize` | An element is resized by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `scroll` | An element is scrolled by a user. | ![Development](https://img.shields.io/badge/-development-blue) |
| `zoom` | An element is zoomed by a user. | ![Development](https://img.shields.io/badge/-development-blue) |

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
92 changes: 92 additions & 0 deletions model/browser/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,95 @@ groups:
brief: A unique ID representing this particular metric instance.
requirement_level: required
examples: ["v3-1677874579383-6381583661209"]
- id: event.browser.user_action
Copy link
Contributor

Choose a reason for hiding this comment

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

Would like to see the id/name be related to the group they come from with the list defined at: https://www.w3schools.com/jsref/obj_events.asp that way we can have a more tailored body/attributes.

stability: development
type: event
name: browser.user_action
brief: >
This event describes actions performed by the user such as click, scroll, zoom, resize, etc.
body:
id: browser.user_action
requirement_level: required
stability: development
type: map
fields:
- id: tag_name
type: string
stability: development
brief: Target element tag name and it is obtained via `event.target.tagName`.
requirement_level: recommended
examples: ["BUTTON"]
Comment on lines +67 to +72
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel that this should be an attribute

- id: xpath
type: string
stability: development
brief: >
Target element xpath by using [XPathExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression).
see [xpath](https://www.w3.org/TR/xpath/).
requirement_level: recommended
examples: ["//*[@id='testBtn']"]
- id: type
type: enum
members:
- id: click.left
value: "click.left"
stability: development
brief: An element is left clicked by a user.
- id: click.right
value: "click.right"
stability: development
brief: An element is right clicked by a user.
- id: click.middle
value: "click.middle"
stability: development
brief: An element is middle clicked by a user.
- id: scroll
value: "scroll"
stability: development
brief: An element is scrolled by a user.
- id: zoom
value: "zoom"
stability: development
brief: An element is zoomed by a user.
- id: resize
value: "resize"
stability: development
brief: An element is resized by a user.
- id: keyboard.enter
value: "keyboard.enter"
stability: development
brief: An element is entered via keyboard by a user.

Choose a reason for hiding this comment

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

This description is not clear to me. is that similar to keyboard.space below? so we track when user hits enter while an element (probably an input) has the focus?

If so I wonder why we want to differentiate between these two keys.

- id: keyboard.space
value: "keyboard.space"
stability: development
brief: A space is entered via keyboard by a user.
- id: other

Choose a reason for hiding this comment

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

another interesting event IMHO is input

value: "other"
stability: development
brief: User actions that are not listed above.
stability: development
brief: >
Type of interaction.
See enum [here](https://github.com/microsoft/ApplicationInsights-JS/blob/main/extensions/applicationinsights-clickanalytics-js/src/Enums.ts) for potential values we could add support for.
requirement_level: required
examples: ["click.right"]
Comment on lines +81 to +125
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel that these should be attributes.

- id: page.x
type: int
stability: development
brief: Click x(horizontal) coordinates(in pixels) relative to the entire document.
requirement_level: recommended
examples:
- 10
- id: page.y
type: int
stability: development
brief: Click y(vertical) coordinates(in pixels) relative to the entire document.
requirement_level: recommended
examples:
- 10
Comment on lines +126 to +139
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use the app.screen.coordinate.* namespace ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1941 (comment) and #2070 should already cover the app click events

- id: tags
type: string[]
stability: development
brief: Grab data from data-otel-* attributes in tree.
requirement_level: recommended
examples:
- ["id", "name"]
Comment on lines +140 to +146
Copy link
Contributor

Choose a reason for hiding this comment

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

Attributes should be set as attributes on the event and don't think that these need to be defined here.

Loading