Double counting
Purpose: Find and fix duplicate hits.
Who this page is for
| Audience | Why it matters to you |
|---|---|
| Analysts | Spot anomalies |
| Implementers | Debug firing issues |
Double Counting
Same action fires multiple times, inflating metrics.
Symptom
Report shows 100 visitors for a page, but manual count is 50.
Either:
- Each visitor is counted twice (double counting)
- Or there's a real increase you didn't expect
Common causes
Cause 1: Multiple tracking codes
Page has both AppMeasurement AND Web SDK:
<!-- WRONG - two libraries -->
<script src="appMeasurement.js"></script>
<script src="alloy.js"></script>
<!-- Both fire hits simultaneously -->
Fix: Remove one library
Cause 2: Page reloads
Page has code that reloads and fires again:
// WRONG - fires on load
sendEvent();
// Then page reloads → fires again
location.reload();
Fix: Only fire once per logical page load
Cause 3: Link click fires twice
Link has onclick handler that fires AND default behavior fires:
<!-- WRONG -->
<a href="/next" onclick="trackClick()">Link</a>
<!-- Both custom tracking and page view fire -->
Fix: Use preventDefault() in handler
document.getElementById('link').addEventListener('click', (e) => {
e.preventDefault(); // stops default navigation
trackClick(); // fires custom event
window.location = '/next';
});
Cause 4: SPA page navigation
Single-page app fire event on route change, then navigation fires again:
router.on('navigate', () => sendEvent()); // fires
// And also...
sendEvent(); // fired somewhere else too
Fix: One place sends events, not multiple
How to find double counting
In AEP Debugger:
- Load page
- Watch Debugger for hits
- Count: how many hit requests fire?
- Should be 1 per page
If 2+ hits appear, you have double counting.
---
Next: Attribution looks wrong