Tracking
Page views
How the script and the SDK count page views, also on client-side navigations, and what a page view carries.
A page view is an event named page_view. The script sends one when the page loads and on every client-side navigation: it listens to history.pushState, history.replaceState and the popstate event, so single-page apps (Next.js, React Router, Astro with view transitions) count every page without extra code.
It compares the pathname: a change that only touches the query string or the hash (?tab=2, #pricing) is not a second page view, because the page itself hasn't changed. A push to a new path is.
Every page view carries:
- The path (
/pricing), without the query string or hash. Query strings never leave the browser. - The referrer, on the first page view after the page loads, when it is another site: its origin and path, also without a query string.
- The UTM tags of the page's URL:
utm_source,utm_mediumandutm_campaign.
In the dashboard the path is the page under Top pages, the referrer's host the source under Sources, and the UTM tags the row under Campaigns. A page view without a referrer is "Direct or unknown".
With the SDK
numbers.autoTrack() does what the script does. Without it, send page views yourself:
numbers.pageView()See the SDK.