DataSag guides · Updated 27 October 2026

Fix duplicate analytics pageviews on your website

Multiple tracking requests do not necessarily mean duplicate pageviews. DataSag sends pageviews, scroll milestones, engagement updates and custom events. Inspect eventName before removing code.

Before you start

Install the DataSag script once on the pages you intend to measure. Use the public key from the project you are inspecting. Publish your change, then test the public domain rather than relying on an editor preview.

Account credentials, database credentials and provider API keys do not belong in the tracking snippet. Keep existing consent controls in place. Report availability depends on your current plan and provider connections.

Fix duplicate analytics pageviews: step by step

  1. Open Network and filter /api/track. Reload once without clicking or scrolling. Inspect eventName in each payload: null identifies a pageview; scroll, click_heatmap and __datasag_engagement are other records.
  2. Count rendered script elements with data-datasag-key. There should be one intended installation for this project. Search your code, site header settings, embeds and tag manager for additional copies.
  3. Remove redundant script insertion mechanisms, keeping the site-wide installation. Two copies execute independently even when their browser download is cached.
  4. Check for custom router listeners that manually send pageviews. The current tracker handles pushState, replaceState and popstate and ignores a repeated pathname. Do not add a second pageview implementation without a demonstrated gap.
  5. Repeat a direct load, a second route and browser Back. Correlate pageview records with actual path changes. A query-only change on the same pathname is not a new pageview in the current tracker.
[...document.querySelectorAll('script[data-datasag-key]')]
  .map(script => ({
    src: script.src,
    key: script.getAttribute('data-datasag-key')
  }));

What a successful check looks like

A single installation and one pageview dispatch for each actual pathname change in the tested sequence. Additional engagement records remain available.

Record the tested URL, date, browser state and observed request. Repeat on a nested page to check the shared installation. Keep the evidence so you can distinguish a later regression from a report-filter change.

Common mistake

Comparing the total number of events with the number of pageviews produces a false duplicate diagnosis. Keep the event categories separate throughout the check.

Find your platform's installation point

Related checks

Understand search and AI visibility · Get setup help