Skip to content
Sign inStart free trial

Pageviews

A pageview is recorded every time a visitor loads or navigates to a page on your site.

A pageview is recorded when:

  • A page is loaded (initial load or full navigation)
  • The tracker’s pageview event is fired manually (e.g. in a single-page app using a non-history router)

The default tracker (tracker.js) automatically fires a pageview on every page load, and also hooks into the browser History API so client-side route changes in single-page apps are tracked automatically (see below).

The tracker hooks into the browser History API (pushState, replaceState, and popstate), so client-side route changes in SPAs are tracked automatically — no manual calls needed. This works with React Router, Vue Router, Angular, SvelteKit, and other history-based routers.

You only need to fire pageview manually if your app navigates in a way that doesn’t touch the History API (rare), for example a hash-based router:

// Only needed for non-history routers (e.g. hash routers)
window.metrixs('pageview')
  • Bot traffic (automatically filtered — see Bot detection)
  • Visitors who have set localStorage.setItem('metrixs_ignore', 'true') in their browser (self-exclusion)
  • Requests from localhost or 127.0.0.1 (unless data-local-dev is set on the script tag)
  • Headless browsers and automation tools (Puppeteer, Playwright, Cypress, etc.)