Next.js install + SPA pageview validation
Next.js Install + SPA Pageview Validation
Admaxxer is a DTC analytics platform with built-in Meta + Google ad ops. Next.js uses client-side routing, which means route transitions do not trigger a full page load and therefore do not fire the browser's native `pageview` — attribution and on-page behavior go silent after the first hit. TL;DR: fire `admaxxer.track('pageview')` on every route change — `router.events.on('routeChangeComplete')` for the pages router, or a `usePathname` + `useEffect` pair in a client component for the app router.
## Symptoms
- First landing pageview is captured, but subsequent internal navigations are missing from Admaxxer.
- Time-on-site and session length look artificially short.
- Attribution works on the first page but funnels that span multiple routes look broken.
- Admaxxer realtime shows user activity flat-line after the entry page.
- `window.admaxxer` is defined, but only one event per session appears in the log.
## Root cause
Next.js renders the initial document on the server, then hydrates and hands navigation to the client. Internal `` clicks trigger a `pushState` and re-render without reloading the document. Any analytics code that lives inside the `