Skip to main content

Troubleshooting

Duplicate events

Every number exactly double, or close to it.

Every number exactly double, or close to it.

Confirming it

Load one page of your site and watch the Network tab. You should see exactly one POST /api/events. Two means the tag is firing twice.

Also count the t.js requests. Two of those means the tag is on the page twice.

screenshot coming

DevTools Network tab on a page with a double install: two t.js requests and two /api/events POSTs from a single page load. Cropped, any browser.

1. The tag is on the page twice

The usual cause, and the usual reason is that it was installed two different ways and one was forgotten.

Common combinations:

  • Google Tag Manager and the head. Installed through GTM, then also pasted into the site's head — or the other way round.

  • A layout and a page. In Next.js: the root layout and a page component. In WordPress: the theme header and a head-injection plugin.

  • A theme and a child theme, both carrying it.

  • Two AI-builder prompts, where the second added a tag without noticing the first.

Find it: view source on the published page and search for truestat. Count the matches. Remove all but one.

2. A component that remounts

The tag was added inside a React or Vue component that mounts more than once. Each mount appends another copy of the script.

The signature: the first page load records one view, and the number grows as you navigate.

Fix: move the tag into the root HTML document or root layout — the file that renders once for the whole app. Every install page in Installing TrueStat names that file for its platform.

Do not add the script from inside an effect hook, and do not remove it in a cleanup function. See Single-page apps.

3. A GTM History Change trigger

If you installed through GTM with a History Change trigger as well as All Pages, every route change loads the tracker again.

The TrueStat script handles route changes itself once it is loaded. It needs only All Pages. Remove the History Change trigger. See Install through Google Tag Manager.

4. A double-firing custom event

If only your goals are doubled and page views are fine, the element is bound twice — usually a data-ts-goal attribute on an element that also has a JavaScript window.truestat() call in its click handler.

Pick one route per element.

5. Not actually duplicates: SPA navigation

A visitor moving through five routes generates five views. That is correct behaviour, not a duplicate — their session is one visitor and five page views.

The check is one page load, one POST. If a single load produces one and navigation produces one each, everything is working.

Router double-calls — replaceState immediately after pushState — are debounced at 100 ms, so those do not produce duplicates either. See Single-page apps.

The cost of leaving it

Every duplicated event counts against your monthly event limit. A double install doubles your usage as well as your numbers, and can push you up a traffic step you do not need. See What counts as an event.

Cleaning up the historical data

There is no way to remove already-recorded duplicates. Deletion is per site or per account, not per range — see Deleting your data.

Once you fix the install, your numbers halve. That step down is the fix taking effect, not a traffic drop — worth noting somewhere before you or a colleague sees the graph and panics.

If a site's whole history is unusable because of it, deleting the site and starting clean is an option, and everything before that point is gone permanently. Export first if any of it matters.

Was this page helpful?

Last updated August 28, 2026