Skip to content
Get started
All articles

Tracking engineering

Browser Events vs Webhooks: Which Should Power Revenue Analytics?

Understand the reliability differences between frontend tracking events and payment-provider webhooks for conversion and revenue reporting.

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

Browser events describe observed user behavior; authenticated provider webhooks describe backend business events. Use both for a full journey, but verify payments from an authoritative server-side source.

Key takeaways

  • Specify persisted ledger outcomes for failure cases.
  • A goal's name does not make it an authoritative payment.
  • Missing attribution must not turn a valid payment into a missing transaction.

What frontend tracking does well

A browser tracker can record pageviews, campaign parameters, pricing clicks, checkout opens, and onboarding actions. It provides context for acquisition and usability. But browsers can close, block scripts, lose connectivity, or deliberately manipulate submitted data.

Even a success-screen event can fire without settlement in an asynchronous payment flow.

What a webhook contributes

An event delivered by a provider can report subscription, payment, or refund state with an authenticated origin when verification is implemented correctly. Webhook delivery still needs retry handling and reconciliation: events can be duplicated or arrive out of order.

Never embed private webhook secrets or provider API keys in public JavaScript.

Combine both without double counting

Keep checkout_started as a funnel event and payment_verified as a financial event. Link them through a supported correlation key or authenticated account relationship. Use unique provider object identifiers and idempotent updates for the payment ledger.

Suppose a shopper refreshes the success page three times after one purchase. Three page events may occur, but the ledger should still contain one verified transaction.

Test the failure path

Simulate a closed browser before redirect, webhook retry, delayed settlement, refund, and lost attribution key. Display unattributed payments rather than silently dropping legitimate revenue.

Write the expected result for four failure cases

A useful isolated integration test specifies ledger outcomes, not just HTTP responses:

Test case Browser observation Financial expectation
Success page refreshed three times Several pageviews may occur One provider transaction
Browser closes before returning No return-page event Valid payment can still arrive by webhook
Provider repeats the notification No extra browser action required No duplicate payment
Visitor association is missing Journey context may be incomplete Payment remains recorded and unattributed

These are test expectations, not statements that every integration automatically satisfies them. Verify the supported provider behavior and inspect the persisted records in a test environment.

In Revfaro, goals represent tracked actions and payment integrations record financial events. A goal named payment_verified is still a goal; naming it that way does not give it the authority of a signed provider notification. Keep the two paths separate so a client retry cannot masquerade as additional collected revenue.

Related reading

Frequently asked questions

Can I track revenue with JavaScript alone?

You can record an intention or client-reported outcome, but reliable financial totals require authoritative reconciliation.

Are webhooks guaranteed to arrive exactly once?

Do not assume that. Build idempotent processing and provider reconciliation.