Tracker

SPAs and hash routing

pushState, replaceState, and popstate are hooked automatically. Hash routing is opt-in.

History API

The script wraps history.pushState and history.replaceState, and listens for popstate. Next.js, Remix, SvelteKit, Vue Router, and React Router all go through those primitives, so client-side navigations count without extra code.

Hash routing

index.html
<script defer data-domain="example.com" data-hash="true"
  src="https://analytics.example.com/js/v5.js"></script>

Manual pageviews

If you have a custom router that does not touch history (rare), call window.v5('pageview') after you update the URL.

Something off? Open an issue · Edit on GitHub