Tracking lab

SPA navigation

Client-side route changes, with and without a poc_spa_navigation push.

Lane C3 · dataLayer events

Try it

Off: route changes will not push dataLayer events.

poc_spa_navigation· dataLayerLane C3 · dataLayer events
page_view· dataLayerpoc_spa_navigation (when on)· dataLayerLane C3 · dataLayer events

Client-side navigation, like the header's Home and About links. Use Back and Forward too.

How it works

The links run the App Router's client-side navigation: the URL changes but the page doesn't reload. The Klaviyo data layer bridge watches dataLayer messages, not browser history, so a route change is only an event if something pushes one.

  1. Option off: navigating pushes no lab event, so the bridge makes no Klaviyo call.
  2. Option on: each route change pushes one poc_spa_navigation, and the bridge passes it to Klaviyo once.
  3. Back and Forward: with the option on, each change pushes one event with navigation_method: popstate.

The site also pushes page_view on every route change, whatever this option says. The bridge's filter excludes Next.js's own gtm.historyChange events.

What to expect in the console

Come back here after navigating. Each lab push shows as poc_spa_navigation · pushed, labelled with the page it happened on (Site: /about), followed by an observed Klaviyo.js call when the bridge forwards it. Exactly one of each per route change is the pass.

Full console