Analytics and conversion measurement

Configure GTM history change triggers for SPAs

Capture accurate virtual pageviews in React and Vite applications using browser History state changes. Single-page applications update URLs dynamically without reloading the document, preventing traditional GTM Page View triggers from firing. Analytics configurations must align with privacy consent standards and platform data policies; verify tag triggers and event payloads before production rollout.

Measurement governance and consent boundaries

Single-page applications update URLs dynamically without reloading the document, preventing traditional GTM Page View triggers from firing.

  • Define business objectives and key conversion events
  • Configure consent-aware triggers and data-layer schemas
  • Verify event delivery in debug and real-time reports

Implementation approach

Configure a custom trigger listening for History Change events, extract the new page path from History Source, and fire virtual pageview tags.

  • Confirm the responsible owner
  • Apply the change to a representative case
  • Document decisions and exceptions

Practical example

A React Router navigation to /solutions/hospitals updates window.location without reloading; GTM fires a virtual pageview with the updated title.

  • Reproduce the starting situation
  • Apply the described approach
  • Check the user-facing result

Verification and follow-up

Navigate through deep client routes in GTM Preview mode, verify page_location parameters match the address bar, and check GA4 real-time views.

  • Test expected and failure cases
  • Compare with the recorded baseline
  • Agree the next review date and owner

Questions to keep in view

When should a team use this analytics and conversion measurement guide?

Capture accurate virtual pageviews in React and Vite applications using browser History state changes.

What should be checked before rollout?

Navigate through deep client routes in GTM Preview mode, verify page_location parameters match the address bar, and check GA4 real-time views.