Pageviews & SPAs
A page_view is sent on every page load, and on every client-side navigation in single-page apps. No code is needed.
What is sent
Each pageview carries the page URL, title, referrer, the visitor's language, and the viewport and screen sizes. The visitor's country, device, browser and acquisition channel are worked out on our side from this request. See Privacy & data.
Single-page apps
The tracker follows the History API: history.pushState, history.replaceState and the back/forward buttons (popstate). A pageview is sent whenever the path, query string or hash changes. This covers Next.js, React Router, Vue Router, Angular, SvelteKit and the like.
Before each new pageview, the engagement of the previous page is sent.
Hash-based routing
If your app routes with the hash (https://example.com/#/pricing), turn on hashMode: the hash becomes the page, and each hashchange is a pageview.
sublim.o = { projectId: 'YOUR_PROJECT_ID', hashMode: true };
In hashMode, a navigation that only changes the path and leaves the hash as it is isn't counted.
Duplicates
The same URL twice within one second is counted once. Redirects and frameworks that call replaceState right after pushState don't inflate your numbers.
Turning it off
| Goal | Options |
|---|---|
| No pageview on navigations | autocapture: false |
No pageview at all, you send them with trackPageview | autocapture: false and trackPageview: false |