Screen tracking
Track page transitions 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 websites and 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 event.track from your router's navigation listener:
window.addEventListener('popstate', () => {
$screeb('event.track', 'page_viewed', {
path: window.location.pathname,
});
});
Mobile webviewsโ
If your JS tag runs inside a native mobile webview, use the event.screen command instead to report screen changes to the host app's targeting engine:
$screeb('event.screen', 'Checkout', {
step: 2,
});
event.screen is only available when the tag runs inside a Screeb-instrumented mobile webview; calling it from a regular browser page throws an error.