Single-page applications

The script records the first page view automatically. For route changes that do not reload the document, call window.gum.page() after the new route is visible.

Record client-side navigation

window.gum.page();

Connect this call to your router's completed-navigation event, not its click event. This ensures that the page path reflects the route the visitor actually reached.

Avoid duplicate views

  • Do not call window.gum.page() on the initial document load.
  • Call it once for each completed client-side route change.
  • Do not call it for state changes that do not change the visible URL or page content.

Related documentation