Single-page applications change the URL without a full document reload. PureStats handles common History API route changes automatically, but custom routers may need manual pageview calls.

## Automatic tracking

The tracker observes:

- Initial page load.
- `history.pushState`.
- `history.replaceState`.
- Browser back and forward navigation.

This covers most React Router, Vue Router and Next.js client transitions.

## Manual tracking

If your app changes visible screens without changing the URL, call:

```js
window.purestats?.trackPageview('/billing/checkout');
```

Pass a path when the browser URL does not reflect the view. If you omit the argument, PureStats uses `window.location.pathname`.

## Avoid duplicate pageviews

Do not call `trackPageview()` after every route change unless automatic tracking fails. Check the Network panel: one route change should produce one accepted pageview event.

## Campaign parameters

UTM parameters are captured on landing pages. If a SPA removes UTM parameters immediately after load, make sure the tracker runs before the URL cleanup.

## Cross-domain flows

When a visitor moves from `www.example.com` to `checkout.example.com`, configure aliases and enable cross-domain stitching if you need the session to continue across hostnames.
