Skip to main content
Version: Browser SDK

Screen tracking

Track page transitions in your app so Screeb can evaluate URL-based and page-level targeting rules for messages and surveys.

Automatic trackingโ€‹

Screeb automatically detects URL changes in the browser. For most single-page apps, no additional setup is needed โ€” navigation events that update window.location are monitored automatically.

Manual event tracking per routeโ€‹

If you want to trigger a specific Screeb event on navigation, call eventTrack from your router's navigation listener:

import * as Screeb from "@screeb/sdk-browser";

window.addEventListener("popstate", () => {
Screeb.eventTrack("page_viewed", {
path: window.location.pathname,
});
});

If your router exposes its own navigation events (e.g. a custom SPA router), call eventTrack from there instead โ€” see Event tracking.