Docs/Guides
.md

Page views

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.

turn it off
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/42 both 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:

example
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.