# How revenue attribution works

How SuprAnalytics ties each payment to the visitor who made it and their earlier visits, first touch versus last touch, and payments without a visitor id.

SuprAnalytics shows which channels, campaigns, pages and countries bring **paying customers**, not just visitors. It does this by connecting each payment to the visitor who made it, and that visitor to every visit they made before paying.

## How it works

**1. The script gives every visitor an id**

It's kept in a first-party cookie, `supr_visitor_id`, for a year, and is also available as `window.supr.visitorId()`.

**2. You pass the id to your checkout**

As metadata on the checkout (or nothing at all for Polar checkout links: the script adds it). Each provider's page shows how.

**3. Your payment provider tells SuprAnalytics about the payment**

Through a webhook (Polar, Stripe, Lemon Squeezy) or the [Payment API](https://supranalytics.app/docs/payments-api.md). SuprAnalytics reads the id back and credits the payment to that visitor's visits.

## First touch and last touch

Each payment remembers the visitor's **first visit** ever and their **last visit** before paying. Choose which one gets the credit in Settings → Revenue → Attribution model:

- **Last touch**: the visit that converted. Good for "what closes the sale?".
- **First touch**: the visit that brought them in. Good for "what finds new customers?".

Last touch counts direct visits, and switching re-credits past payments too. For a longer explanation with worked examples, read [first-touch vs last-touch attribution](https://supranalytics.app/blog/first-touch-vs-last-touch-attribution).

## Payments without a visitor id

They still count in your revenue. SuprAnalytics then looks for the visitor another way: the same **customer id** on an earlier payment, or a visitor with the same **email** (from [identify](https://supranalytics.app/docs/user-identification.md) or an earlier payment). If nothing matches, the payment is revenue without a source.

## Pick your provider

- [Polar](https://supranalytics.app/docs/polar.md): Webhook, then checkout links or the API.
- [Dodo Payments](https://supranalytics.app/docs/dodo.md): Webhook, then payment links or checkout sessions.
- [Paddle](https://supranalytics.app/docs/paddle.md): Webhook, then Paddle.js checkout custom data.
- [Stripe](https://supranalytics.app/docs/stripe.md): Webhook, then Checkout or Payment Links.
- [Lemon Squeezy](https://supranalytics.app/docs/lemonsqueezy.md): Webhook and checkout custom data.
- [Any other provider](https://supranalytics.app/docs/payments-api.md): Send payments from your server.

---

This page on the web: https://supranalytics.app/docs/revenue-attribution
Every documentation page: https://supranalytics.app/docs.md
