-
Notifications
You must be signed in to change notification settings - Fork 5
Description
The purpose of this issue is to come to a decision on what a page view event should represent, and how it should be implemented.
Work in progress:
Definitions
Navigation:
Action that changes the current history entry. This includes loading a new document, changing URL fragment, going back/forward, reloading, changing the URL programmatically
Hard navigation / page load:
HTML document is loaded in the browser
Soft navigation:
An event that appears to the user as a page load, but does not involve loading a new HTML document - URL is changed without loading a new HTML document, DOM is updated programmatically. The main use case is route changes in SPA applications.
Page view:
TBD
Use cases
There are a few use cases that we are trying to address:
-
Provide an event that can be used to reliably capture count of page loads (hard navigations).
Hard navigations result in many events (e.g. window load, navigation-timing, FCP, LCP) that could also be used for this but are less reliable. Sending an event as soon as the SDK is initialized would guarantee that the page load is counted. In this case, page view is simply synonymous with page load. -
Automatically capture events that represent route changes in SPA applications.
These are also referred to as soft navigations, and to users they appear the same as page loads - URL changes and content of the page changes. -
Capture all URL changes including ones in the same document
This essentially means capturing all navigation events. Not all URL changes represent a logical page view, but this would give us comprehensive data about navigation/history. -
Capture events that represent views of a section of the application.
Examples include displaying a dialog, displaying specific content in a sub-section of a page, or perhaps changing the whole page content without changing the URL. This definition of a view does not couple the page content with the URL, and it would likely need to be captured using an API (since it is not possible to automatically determine what change in DOM represents a page view). -
Capture events that represent multiple related pages.
This is related to the previous use case with the distinction that multiple pages can be combined into a single view. For example, auser
view could include user list page and user profile page.
Questions
What should the page view event represent? Should it represent hard navigation only? Should it also represent SPA route changes (soft navigation)? Should it represent a logical page view that may or may not involve URL change? Should we even use this term if it is not clear/self-explanatory?
Do we need instrumentation solely for the purpose of counting page loads?
Should we capture SPA soft navigations as page view events or soft navigation events?
Comments
The original intent of the event as proposed in open-telemetry/semantic-conventions#1910 was to cover use cases 1 and 2.
However, we do not have consensus on how to capture soft navigations. Should we follow the ongoing experimental work to standardize soft navigations? Or, should we simply capture all same-document navigation events as "virtual" page views? In other words, we do not have consensus on what a virtual page view is.
In addition, use cases 4 and 5 provide yet another definition of a page view. Here it represents more of a logical page view that may or may not be tied to a specific URL or URL change.