Skip to content

Commit 19d3875

Browse files
docs: use cases for the navigation event (#41)
* capture use cases for the navigation event * fixed link from the observability model * Apply suggestion from @vigneshshanmugam Co-authored-by: Vignesh Shanmugam <[email protected]> * Apply suggestion from @vigneshshanmugam Co-authored-by: Vignesh Shanmugam <[email protected]> * updated headings for same-document navigation --------- Co-authored-by: Vignesh Shanmugam <[email protected]>
1 parent 61b34c8 commit 19d3875

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

docs/browser-observability-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This structure ensures that browser-related events can be consistently interpret
2323

2424
| Event | Description | Semantic Conventions Status | Instrumentation Status |
2525
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26-
| `browser.navigation` | Captures a page page navigation event (both hard navigations and soft SPA navigations). | In review [PR2806](https://github.com/open-telemetry/semantic-conventions/pull/2806) | Not created |
26+
| [`browser.navigation`](navigation-event.md) | Captures a page page navigation event (both hard navigations and soft SPA navigations). | In review [PR2806](https://github.com/open-telemetry/semantic-conventions/pull/2806) | Not created |
2727
| `browser.navigation_timing` | Captures detailed technical milestones from the [PerformanceNavigationTiming](https://developer.mozilla.org/docs/Web/API/PerformanceNavigationTiming) API. | In review [PR1919](https://github.com/open-telemetry/semantic-conventions/pull/1919) | Not created |
2828
| `browser.resource_timing` | Captures information about individual resources loaded by the page, from the [PerformanceResourceTiming](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming) API. | In review [PR3069](https://github.com/open-telemetry/semantic-conventions/pull/3069) | Merged (similar, as spans) [instrumentation-document-load](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-document-load) |
2929
| `browser.web_vital` | Captures Web Vitals metrics such as CLS, INP, LCP, and FID. | Merged [WebVitals](https://opentelemetry.io/docs/specs/semconv/browser/events/#webvital-event) | Not created |

docs/navigation-event.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Navigation event
2+
3+
## Purpose
4+
5+
- Provide a reliable signal that a navigation occurred for analytics, session, and user-journey analysis.
6+
- Complement (not replace) the `browser.navigation_timing` event, which is used for performance metrics.
7+
8+
## Use cases
9+
10+
### Reliable count of page loads (hard navigations)
11+
12+
For full page loads, this event SHOULD be emitted as early as practical after the browser commits the new URL. Durations and detailed milestones for page load are captured separately by the Navigation Timing event (from the PerformanceNavigationTiming API). Navigation timing data is typically sent when timing fields are finalized (often after the `load` event), which means the event might be lost if the user leaves the page early or if `load` event never fires. The navigation event therefore provides a more reliable analytics signal, while navigation timing is used for performance analysis.
13+
14+
Hard page loads MUST be distinguishable from other navigation types. Implementations MUST include the `same_document` attribute to indicate whether the navigation replaced the document (`same_document = false`) or not.
15+
16+
### Capturing same-document navigations
17+
18+
#### Soft navigations
19+
20+
The concept of soft navigation (e.g., SPA route changes) is not standardized and is typically implemented by framework routers. Practical heuristics include: initiated by a user action (for example, a click) and resulting in both a URL change (e.g., `history.pushState`/`replaceState`) and a visible change in page content.
21+
22+
Since soft navigations are analyzed similarly to page loads, they SHOULD be represented using this navigation event as well.
23+
24+
TODO: Define how soft navigations are identified and represented in semantic conventions. This is not standardized yet.
25+
26+
#### Other URL changes
27+
28+
This event can also capture same-document navigations for deeper session and user-journey analysis. Examples can include:
29+
30+
* Hash changes (for example, links to sections within the same document)
31+
* Query/search parameter changes when application state is encoded in the URL
32+
* Certain back/forward interactions that do not replace the document (depending on history state)
33+
34+
The main purpose of the navigation event is to cover hard page loads and soft navigations. Other same-document navigations can introduce noise. Therefore, by default the instrumentation SHOULD NOT collect these additional events, but MAY allow them to be enabled via configuration.

0 commit comments

Comments
 (0)