-
Notifications
You must be signed in to change notification settings - Fork 6
docs: use cases for the navigation event #41
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||
| # Navigation event | ||||||
|
|
||||||
| ## Purpose | ||||||
|
|
||||||
| - Provide a reliable signal that a navigation occurred for analytics, session, and user-journey analysis. | ||||||
| - Complement (not replace) the `browser.navigation_timing` event, which is used for performance metrics. | ||||||
|
|
||||||
| ## Use cases | ||||||
|
|
||||||
| ### Reliable count of page loads (hard navigations) | ||||||
|
|
||||||
| 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 it may be missing if the user leaves early or if `load` never fires. The navigation event therefore provides a more reliable analytics signal, while navigation timing is used for performance analysis. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ### Capturing soft navigations | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| Since soft navigations are analyzed similarly to page loads, they SHOULD be represented using this navigation event as well. | ||||||
|
|
||||||
| TODO: Define how soft navigations are identified and represented in semantic conventions. This is not standardized yet. | ||||||
|
|
||||||
| ### Capturing same-document navigations | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 suggestion: From my understanding, "soft navigations" are included in "same-document" navigations. It might be easier to understand if we had a structure like this:
|
||||||
|
|
||||||
| This event can also capture same-document navigations for deeper session and user-journey analysis. Examples can include: | ||||||
|
|
||||||
| * Hash changes (for example, links to sections within the same document) | ||||||
| * Query/search parameter changes when application state is encoded in the URL | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that a query string change can lead to no modification of the page content (maybe is just a way of keeping internal state), should that be defined as navigation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I recall correctly that was the issue that made us differentiate Wasn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also can't remember but I'm ok with it if that's what we agreed on |
||||||
| * Certain back/forward interactions that do not replace the document (depending on history state) | ||||||
|
|
||||||
| 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. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.