# See which traffic pays you.

Not just which traffic arrives. Revenue attribution credits every payment to the visit that led to it. Connect your payment provider and revenue sits next to visitors in every report: by source, page, campaign, country and device.

Try it on sample data: [Revenue attribution in the demo](/app/demo/revenue)

## Revenue beside every number

A thousand visitors from one source and a hundred from another tell you little until you see what each group paid. With a provider connected, the sources, pages, campaigns and countries you already look at gain a revenue column, and the main chart draws revenue bars under the visitor line.

It changes the questions you ask. Not which post got the most traffic, but which post brought customers. Not which channel grew, but which one is worth more of your week.

- Revenue and revenue per visitor by source, page, campaign, country and device
- Refunds and chargebacks recorded as negative payments, so totals stay true
- Conversion means a first payment, so the rate is about money, not signups

## Every payment, traced to a visit

Each payment shows the product, the amount, the provider, and the source and landing page of the visit behind it. Open the visitor and you see the whole path: the referrer, the pages read, the signup, the payment.

If the person paying is still on your site, the payment appears in the live feed and lights up their point on the globe.

## Fourteen providers, or one API call

CrispStats connects Stripe, Polar, Paddle, Dodo Payments, Creem, Whop, Razorpay, Freemius, Lemon Squeezy, Shopify, RevenueCat, Superwall, App Store and Shopify App Store. You paste a key, and CrispStats imports your past payments, then reads each new one back from the provider's API before it counts, so the revenue is verified. Payments arrive by webhook within seconds where the provider sends one, and a regular check catches anything missed; a payment seen twice is counted once. Test-mode payments are kept out of revenue.

On another provider, or for payments you take some other way, report the payment from the browser with one call, or from your server with an API key.

## Two steps. A key and the visitor id.

1. **Paste a key.** In your site's settings, choose your payment provider and paste a key from its dashboard: the panel links to the page where the key is made. The webhook, if the provider has one, is created for you, and past payments are imported.

2. **Pass the visitor id to checkout.** Read the anonymous visitor id in the browser and send it with the checkout, as Stripe's client_reference_id or as metadata. That is how a payment finds its visit.

```js
// In the browser, before you send the visitor to checkout
const visitorId = await crispstats.id();

// On your server, when you create the Stripe Checkout session
const session = await stripe.checkout.sessions.create({
  metadata: { crispstats_visitor_id: visitorId },
  // …
});
```

3. **Or report it yourself.** Billing some other way? Send the amount in cents and the currency from the browser after a successful payment.

```js
// For a provider without a webhook: amount in cents, ISO currency
crispstats.revenue(4900, "USD");
```

## Frequently asked questions

### Does this need cookies?

No. The visitor id is the same daily-rotating hash every event is filed under. You read it in the browser when someone heads to checkout, and the payment carries it back. Nothing is stored on the visitor's device.

### What if someone pays days after their first visit?

The default visitor id lasts one day. A payment made days later is still recorded with its amount, credited to the visit that sent the person to checkout. If you turn on persistent visitors, which keeps an id in the browser and generally needs consent, one visitor keeps the same id across days.

### Which Stripe events are used?

Completed checkout sessions, paid invoices for subscriptions, payment intents that carry the visitor id in metadata, and refunds. One event is chosen per charge, so a payment is never counted twice.

### Are customer emails stored?

No. Where a provider sends an email, it is hashed and masked before it is stored. The address itself never is.

### Does it offer multi-touch attribution?

No. Each payment is credited to the first touch known for that visitor. Multi-touch attribution models, whether a rule such as linear, time decay or position-based or a data-driven model, are not offered. There is no attribution window setting either: the attribution window is as long as the visitor id lasts, one day by default, longer with persistent visitors or for users you identify.

### Is revenue attribution a paid add-on?

No. It is on every CrispStats plan and in the free trial, and payments do not count as events.
