Skip to content

Conversation

@joaquin-diaz
Copy link

@joaquin-diaz joaquin-diaz commented Oct 28, 2025

Changes

Added a new event for browsers named user_action.click. This event captures the "click" action in browsers

Prototype instrumentation:
open-telemetry/opentelemetry-browser#35

Important

Pull requests acceptance are subject to the triage process as described in Issue and PR Triage Management.
PRs that do not follow the guidance above, may be automatically rejected and closed.

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

Copy link
Contributor

@thompson-tomo thompson-tomo left a comment

Choose a reason for hiding this comment

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

This seems too generic and instead I feel we should aim for tailored click, key etc events. Ideally at a mimum following https://www.w3schools.com/jsref/obj_events.asp but also potentially splitting a couple ie mouse & click. That way we can easily tailor attributes based on the trigger.

Also for click events Why not extend https://opentelemetry.io/docs/specs/semconv/app/app/#event-appwidgetclick but keep the same name?

Comment on lines +53 to +62
- id: browser.page.x
type: int
stability: development
brief: 'Click x (horizontal) coordinates (in pixels) relative to the entire document.'
examples: [10]
- id: browser.page.y
type: int
stability: development
brief: 'Click y (vertical) coordinates (in pixels) relative to the entire document.'
examples: [10]
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +63 to +67
- id: browser.tag_name
type: string
stability: development
brief: 'Target element tag name obtained via event.target.tagName.'
examples: ['BUTTON']
Copy link
Contributor

Choose a reason for hiding this comment

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

@joaquin-diaz
Copy link
Author

This seems too generic and instead I feel we should aim for tailored click, key etc events. Ideally at a mimum following https://www.w3schools.com/jsref/obj_events.asp but also potentially splitting a couple ie mouse & click. That way we can easily tailor attributes based on the trigger.

Yeah.. I think having multiple events makes sense. It would make it easier to know which attributes to expect vs a bunch of mixed possible attributes depending on type

Also for click events Why not extend https://opentelemetry.io/docs/specs/semconv/app/app/#event-appwidgetclick but keep the same name?

I wasn't part of the original discussion but it seems they preferred to use browser terminology instead of translating e.g. event.pageX -> app.screen.coordinate.x.

Some of these app attributes as easy to translate from browser APIs but some are not as straight forward. app.widget.id and app.widget.name are hard to understand in a browsers perspective. Based on their definitions:

  • app.widget.id: An identifier that uniquely differentiates this widget from other widgets in the same application. Examples: f9bc787d-ff05-48ad-90e1-fca1d46130b3; submit_order_1829
  • app.widget.name: The name of an application widget. Examples submit; attack; Clear Cart

A widget is an application component, typically an on-screen visual GUI element.

Component is a loaded term in web, it can be confused for example with a React component that can be composed of multiple dom elements.

app.widget.id is marked as required in app.widget.click but there's no equivalent in the browser that is always present, you may have an id, but not always. You also have xpath but that can change if dom elements are added or removed. app.widget.name could be the element tag name

IMO I would like to have shared events between client SDKs (web and mobile) but they work for both cases, app.widget.click seems to be too tailored for mobile apps and it feels like a stretch to apply it here. I'll bring this up to the browser sig on Thursday and get their input

@thompson-tomo
Copy link
Contributor

I wasn't part of the original discussion but it seems they preferred to use browser terminology instead of translating e.g. event.pageX -> app.screen.coordinate.x.

So I have seen at https://www.w3schools.com/jsref/obj_mouseevent.asp and page/app are in effect different measurements so perhaps we go with app.page.coordinate.x.

Some of these app attributes as easy to translate from browser APIs but some are not as straight forward. app.widget.id and app.widget.name are hard to understand in a browsers perspective.

I agree but I think we can improve the description to resolve those issues and use the attribute notes to define how to source it. For widget id = html element id and fall back to xpath when not defined.

@thompson-tomo
Copy link
Contributor

Could someone from the browser sig or a maintainer add the triage accepted label so that the hw.mouse.button can be added to hardware namespace and not have this PR auto closed?

Comment on lines +83 to +100
- id: hw.mouse.button
type:
members:
- id: left
value: 'left'
brief: Left button
stability: development
- id: middle
value: 'middle'
brief: Middle button
stability: development
- id: right
value: 'right'
brief: Right button
stability: development
stability: development
brief: 'User friendly name of the mouse button pressed. See [MouseEvent.buttons](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#value).'
examples: ["left"]
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be in the registry file in the hardware folder. But only make the change once the triage:accepted label has been added.

@joaquin-diaz joaquin-diaz changed the title feat: Add Browser UserAction Event feat: Add Browser click Event Oct 30, 2025
@joaquin-diaz joaquin-diaz changed the title feat: Add Browser click Event feat: Add Browser click event Oct 30, 2025
@tedsuo tedsuo moved this to In Progress in Browser: Phase 1 Oct 30, 2025
@joaopgrassi joaopgrassi moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:browser enhancement New feature or request

Projects

Status: In Progress
Status: Awaiting codeowners approval

Development

Successfully merging this pull request may close these issues.

3 participants