Revenue attribution
Revenue attribution
Connect Stripe, Polar, Lemon Squeezy, Paddle or Razorpay and see which referrer, campaign and page each payment came from.
Pageviews tell you where visitors come from. Revenue attribution tells you which of those sources actually pay. Every successful payment is matched to the visitor who made it, and credited to the channel that first brought them to your site.
How it works
- The tracking script gives every browser an anonymous visitor id, stored in
localStorageunder_ana_vid. - When a visitor starts checkout, you pass that id to your payment provider, in a field each provider already has for your own data (the table below says which).
- When the payment succeeds, the provider calls your VisitTrack webhook. We verify the signature, read the visitor id back and record the payment against that visitor.
- The payment inherits the visitor's first touch: first referrer, first UTM source/medium/campaign and first landing page. It also records how many days and visits it took to convert.
// The tracker stores one anonymous id per browser. Read it on the page
// that starts checkout and send it along with the checkout request.
const visitorId = window.visitrack?.visitorId?.() ?? localStorage.getItem("_ana_vid");No visitor id, no attribution
This one field is the whole integration. If you connect the webhook but don't pass the visitor id, payments arrive, but VisitTrack can't tell whose they are, so they aren't counted.
Pick your provider
Where the visitor id goes
| Provider | Field | Payment event | Refund event |
|---|---|---|---|
| Stripe | client_reference_id | checkout.session.completed | charge.refunded |
| Lemon Squeezy | custom.visitrack_visitor_id | order_created | order_refunded |
| Polar | metadata.visitrack_visitor_id | order.paid | refund.created |
| Paddle | custom_data.visitrack_visitor_id | transaction.completed | adjustment.created |
| Razorpay | notes.visitrack_visitor_id | payment.captured | refund.processed |
What you get
- Revenue tab. Totals, revenue per visitor, and revenue broken down by referrer, campaign and landing page.
- Overview chart. Revenue bars next to visitors, so you can see which days traffic turned into money.
- Visitor profiles. Each paying visitor shows their payments next to their full visit history.
- Funnels. Every attributed payment also writes a
payment_completedevent (withamountCents,currencyandproviderin its props). You can use it as a funnel step without sending anything yourself. - Live globe. Payments appear as a burst on the visitor's location.
Refunds
Subscribe to the refund event as well and refunded payments are subtracted automatically, including partial refunds. The refund is matched to the original payment by the provider's own payment id, so it doesn't need the visitor id again.
Security
- Every webhook is verified against the signing secret you pasted into Settings. An unsigned or tampered request gets a
400and records nothing. - Secrets and API keys are stored encrypted. They're only ever used to verify signatures (and, for Stripe, a restricted read-only key).
- Retried deliveries are deduplicated on the provider's payment id, so a webhook delivered twice counts once.
- Revenue can't come from the browser. A visitor can't fake a payment by calling the tracker.
Something missing? Tell us.
AI agent or LLM? Read this page as markdown.