WebmasterID logoWebmasterID
Data quality

History-change double counting

Single-page apps signal navigation through the History API, and GTM's History Change trigger listens for it. Some routers call pushState and then emit their own navigation event, or fire popstate alongside a manual push, so the trigger fires more than once per route change. Each firing sends a virtual pageview, inflating counts. This page explains history-change double counting and how to make the trigger fire once.

Partially verified

Why it fires twice

The GTM History Change trigger reacts to pushState, replaceState, and popstate events. Many SPA routers manipulate history and then dispatch their own change event, and some call replaceState immediately after pushState to normalize the URL. Each of these can satisfy the trigger, so one user action produces two or more history events — and two or more virtual pageviews.

The duplicates share the same page path and arrive within milliseconds, which is the signature to look for.

Making it fire once

Constrain the trigger to the specific change you want — for example, fire only when the New History Fragment differs from the Old, ignoring replaceState normalizations. Better, drive the pageview from one explicit dataLayer push your router emits on a confirmed route change, instead of inferring it from raw history events. Then verify in preview that one navigation yields exactly one tag fire.

This is distinct from generic SPA tracking gaps where the route fires too few times; here it fires too many.

How it appears in analytics and logs

Two identical virtual pageviews milliseconds apart for one navigation usually mean the History Change trigger fired twice, not that the user navigated twice.

Diagnostic use case

Stop inflated single-page-app pageviews caused by a History Change trigger firing multiple times for one route transition.

What WebmasterID can help detect

WebmasterID can record route changes from a single explicit signal, avoiding the duplicate firings that History-based triggers produce.

Common mistakes

Privacy and accuracy notes

Deduplicating virtual pageviews uses event timing and URLs, not identity. WebmasterID applies privacy-safe language and stores no personal identifiers for this.

Related pages

Sources and verification notes

Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.