page event records one page view on a website. The Web SDK sends it on load and on each route change in a single-page app. Page views drive visitors, sessions, bounce rate, entry and exit pages, and acquisition.
Send a page view
WithautoPageviews: true (the default), you do not need to call anything. To send one by hand:
page() without properties sends nothing when the path and query are the same as the last page view. With properties, it always sends.
The SDK sends a page view on the first load, when pushState or replaceState changes the path, after back and forward (when the framework has changed the title, at most 1 second later), and on a ua:navigate event on window. See single-page apps and client routing for Astro View Transitions and Next.js.
Fields
See common fields for the envelope fields and the fields that the collector adds.
What is removed
The SDK sends only the URL origin and path. It removes query strings and fragments. Only the allowlisted campaign and click ID fields are kept, incontext.
Rules
- A
pageevent needscontext.page. A game or app build cannot sendpageevents: send atrackevent, such asscreen_view, instead. - The collector refuses the batch with
403when the page URL is not on the project domain, one of its subdomains, or a host in the project’s allowed origins (for example*.itch.zone). - The collector refuses the batch with
400whencontext.page.pathdoes not match the URL.