Automatic page view tracking for SPAs and mobile screens
Pages are tracked automatically in the browser. Screens in mobile apps take one line.
Automatic in the browser#
After init, the SDK sends a page_viewed event on load and on every client-side route change (Next.js, React Router, Vue Router, SvelteKit…). Nothing to add. Every other event is also attached to the page it happened on, so you can see where a checkout_started really happens.
init("SB-EU-xxxxxxxxxx", { pageviews: false });What is sent#
- Only the path:
/pricing. Never the query string or the hash, which often hold tokens or emails. - The server replaces identifiers with
:id, so/projects/8f3a…and/projects/42both become/projects/:id, and your Pages list stays readable. - An email or a long token inside a path is replaced too.
Hash routers and mobile screens#
If your routes live in the hash (/#/settings), or in a mobile app, record views yourself:
import { trackPageview } from "@shipabase/js"; trackPageview("/settings");See React Native & Expo for a one-line setup with Expo Router or React Navigation.
Already tracking page_viewed yourself?#
Remove your manual trackEvent("page_viewed", …) calls after upgrading to @shipabase/js 0.4, or set pageviews: false, so views aren’t counted twice.
Related guides
DocsHow sessions are counted without cookies (30-minute gap)How visits are grouped, and how conversions are counted.DocsReact Native and Expo analytics: track screens and eventsTrack screens and events in a mobile app built with Expo or React Native.DocsHow Shipabase counts visitors without cookies or stored IPsWhat the SDK sends, how visitors are counted, and what you should never send.BlogWhy your AI traffic shows up as “Direct”ChatGPT, Claude and Gemini send you visitors your analytics can’t see. Why the source disappears, and what you can still measure.BlogHow to know if ChatGPT sends you trafficReferrers, utm_source and what AI assistants don’t tell you. And how to see AI traffic in one card.