Skip to content
Get started
All articles

Tracking engineering

Analytics Event Deduplication: Stop Double-Counting Conversions

Prevent duplicate analytics goals, purchases, and webhook events with idempotency keys, stable identifiers, and failure-path testing.

Updated

A left-to-right pipeline connects browser capture, collector acceptance, queue processing and report visibility, with a note that a server key stays on the server.

Quick answer

Event deduplication ensures that a repeated notification or retry does not create an extra business action. It is essential for revenue, signup, and billing reports where inflated counts lead to wrong decisions.

Key takeaways

  • Real repeated actions and repeated delivery are different cases.
  • Avoid duplicate browser instrumentation for the same action.
  • Verify each endpoint's deduplication contract instead of assuming a universal guarantee.

Understand why duplicates happen

A user double-clicks Submit, a browser retries after a timeout, a queue worker restarts, or a payment provider redelivers a webhook. Each may produce repeated messages describing one underlying action.

Do not assume that identical timestamps or matching page URLs are sufficient proof. Legitimate repeated events also happen, especially pageviews.

Choose a stable identity for the event

For payments, use authoritative provider object and event IDs with appropriate uniqueness rules. For server-side business events, create an idempotency key tied to the actual operation. Store and check it transactionally so concurrent workers cannot both commit the same conversion.

Separate message deduplication from payment state reconciliation; a later legitimate refund update must still be applied.

Test the failure window

Simulate success followed by lost HTTP acknowledgment, then resend. Simulate two workers consuming the same job and a crash immediately after database commit. The end state should contain one business event and consistent counters.

For browser events, define when repeat actions are legitimate instead of discarding everything sharing a name.

Monitor the protection

Count duplicates prevented, invalid event IDs, ingestion failures, and reconciliation gaps. A sudden increase in deduplication may reveal a retry storm or frontend bug worth fixing.

Separate three forms of repeated activity

An illustrative checkout can produce three different repetitions: the person genuinely opens checkout twice, the same HTTP notification is delivered twice, and two distinct provider events refer to one payment. A single rule such as “drop events with the same name” cannot handle all three correctly.

For browser instrumentation, assign one owner to the action. Do not attach data-rf-goal and an equivalent manual tracker.goal() call to the same click. For payments, reconcile using the provider object and supported event semantics. For your server's business operation, persist an operation identity with the actual state transition.

Revfaro's goal guide counts repeated completions intentionally. Its server goal endpoint does not provide a documented idempotency-key field, so do not assume arbitrary retries are exactly-once. The payment integrations have separate duplicate and refund handling. Test each boundary with a deliberately repeated message in an isolated environment and inspect the final count or amount.

Related reading

Frequently asked questions

Can I deduplicate by event name alone?

No. Different real events may have the same name; use an appropriate stable event identity.

Should duplicate webhook delivery return an error?

Usually treat an already safely processed delivery idempotently according to provider guidance, rather than provoking endless retries.