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

Add browser page view event #1910

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions docs/browser/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--- Hugo front matter used to generate the website version of this page:
linkTitle: Events
--->

# Semantic conventions for Browser events

**Status**: [Development][DocumentStatus]

This document defines semantic conventions for browser (web) instrumentations
that emit events.

## Page View Event

<!-- semconv event.browser.page_view -->
<!-- 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.page_view`.

This event represents a browser page load/view.

The primary use case is to capture metrics about the number of views of a page. Page view can be a hard page load in a browser as well as virtual navigation in a SPA (single-page application). The event should be collected as soon as possible without waiting for potentially delayed data such as the Navigation timing browser API.

**Body fields:**

| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| `change_state` | string | Type of state change used for the virtual page navigation | `pushState`; `replaceState` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `referrer` | string | Referring Page URI (document.referrer) whenever available. | `https://en.wikipedia.org/wiki/Main_Page` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `title` | string | Page title DOM property | `Home`; `Checkout` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `type` | enum | Type of navigation | `0`; `1` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| `url` | string | Full HTTP request URL in the form scheme://host[:port]/path?query[#fragment]. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. | `https://en.wikipedia.org/wiki/Main_Page`; `https://en.wikipedia.org/wiki/Main_Page#foo` | `Required` | ![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 |
|---|---|---|
| `0` | Initial page load within the browser which will generally also precede a PageNavigationTiming event. | ![Development](https://img.shields.io/badge/-development-blue) |
| `1` | This is for Single Page Applications (SPA) where the framework provides the ability to perform client side only page "navigation", the exact definition of what a virtual page change is determined by the SPA and the framework it is using. | ![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
67 changes: 67 additions & 0 deletions model/browser/events.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
groups:
- id: event.browser.page_view
stability: development
type: event
name: browser.page_view
brief: >
This event represents a browser page load/view.
note: >
The primary use case is to capture metrics about the number of views of
a page. Page view can be a hard page load in a browser as well as virtual
navigation in a SPA (single-page application). The event should be
collected as soon as possible without waiting for potentially delayed
data such as the Navigation timing browser API.
body:
id: browser.page_view
requirement_level: required
stability: development
type: map
fields:
- id: referrer
type: string
stability: development
brief: Referring Page URI (document.referrer) whenever available.
requirement_level: recommended
examples: ["https://en.wikipedia.org/wiki/Main_Page"]
- id: type
type: enum
members:
- id: physical_page
value: 0
stability: development
brief: >
Initial page load within the browser which will generally also
precede a PageNavigationTiming event.
- id: virtual_page
value: 1
stability: development
brief: >
This is for Single Page Applications (SPA) where the framework
provides the ability to perform client side only page
"navigation", the exact definition of what a virtual page
change is determined by the SPA and the framework it is using.
stability: development
requirement_level: required
brief: Type of navigation
examples: [0, 1]
- id: title
type: string
stability: development
requirement_level: recommended
brief: Page title DOM property
examples: ["Home", "Checkout"]
- id: url
type: string
stability: development
requirement_level: required
brief: >
Full HTTP request URL in the form scheme://host[:port]/path?query[#fragment].
Usually the fragment is not transmitted over HTTP, but if it is
known, it should be included nevertheless.
examples: ["https://en.wikipedia.org/wiki/Main_Page", "https://en.wikipedia.org/wiki/Main_Page#foo"]
- id: change_state
type: string
stability: development
requirement_level: recommended
brief: Type of state change used for the virtual page navigation
examples: ["pushState", "replaceState"]
Loading