# How revenue attribution works

> How payments are matched to visitors and which channel gets the credit.

Revenue attribution answers one question: which traffic brought the people who paid you? Reveata does it in two steps.

## 1. Match the payment to a visitor

When a payment arrives, Reveata looks for its visitor using the strongest signal available:

1. **Visitor id in the checkout metadata** (`reveata_visitor_id`), added by the script or by your code.
2. **Session id in the checkout metadata** (`reveata_session_id`).
3. **User id** you sent with [identify](https://reveata.com/docs/identify-visitors) (`reveata_user_id` in metadata, or `userId` in the API).
4. **Email address** of an identified visitor.
5. **The customer’s earlier payments**: once a customer is matched, their renewals follow.

A payment that matches nothing is still counted in your revenue, as unattributed.

## 2. Credit a traffic source

The matched visitor’s sessions before the payment are the touches. The website’s attribution model decides which one gets the credit:

| Model                 | Credit goes to                                                                              |
| --------------------- | ------------------------------------------------------------------------------------------- |
| First touch           | The session that first brought the visitor. Good for finding where new buyers discover you. |
| Last touch            | The last session before the payment.                                                        |
| Last non-direct touch | The last session that was not a direct visit.                                               |

Only sessions inside the attribution window (90 days by default) before the payment count. Change the model and window in the website’s **Settings → Payments**.

## Renewals and refunds

- Renewals of a subscription inherit the attribution of the first payment, so a channel keeps getting credit for the customers it brought.
- Refunds subtract from the original payment’s source.
- Amounts are converted to the website’s currency using the exchange rate of the payment day.

## Where revenue shows up

Revenue appears next to visitors on every report (channels, sources, campaigns, pages, countries, devices) together with customers, conversion rate and revenue per visitor.
