> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Attribution models

> How your agent credits each order to the visits before it, by last click, first click or linear, with ROAS by ad account and LTV by channel.

Updated: 2026-11-30

Attribution credits each order to the visits that came before it, so your agent can say which channel, ad account and campaign brought the money. Ask for revenue with `attribution`, and your agent picks a model and a window.

## Which models are there?

Take one buyer who came from a Meta ad 10 days before their order, from Google search 5 days before, and directly the day before, then paid 100.

| Model | Credits | Here |
| --- | --- | --- |
| Last click | The last visit that isn't Direct, else Direct | Organic search 100 |
| First click | The first visit | Paid social 100 |
| Linear | Every visit an equal share | 33.33 each, adding up to exactly 100 |

The **window** is how many days before the order count: 1, 7, 14, 28 or 90. It's 28 unless you ask otherwise. With a 7-day window, the Meta visit above is too old, and first click credits Organic search.

## How does it know the buyer?

From what the order names, never by guessing:

- the visit and device the order happened on ([Shopify](/docs/sources/shopify) puts it on the cart);
- the Shopify customer, so their visits on a phone and a laptop count as one person;
- other orders with the same email's hash.

Visits across days are joined only for buyers who agreed to tracking, or where the shop's consent setting allows it. Two different customers on one device always stay two people.

## What is Unattributed?

An order with no known visit, such as from a buyer who never agreed to tracking or came straight from an email app. It's counted as **Unattributed**, never dropped. Every attributed answer says how much of the revenue has a known journey (its **coverage**).

## How do you read ROAS by ad account and campaign?

Ask your agent for ROAS by ad account, network or campaign under a model. It sets each ad account's spend against the revenue credited to its campaigns:

- **The ad network** comes from the visit's click id (such as `gclid` or `fbclid`), else its `utm_source`.
- **The campaign** is the visit's `utm_campaign`, matched to the ad account's campaign by your links first, then by name. Link one that doesn't match by name with `link_campaign`.
- **The ad** inside a campaign is covered in [ROAS by ad](/docs/learn/ad-roas).
- **A campaign that matches none** is listed as `meta, account unknown` (its network's source name), apart from the rest.

## What is LTV?

Ask your agent for `kind: "ltv"`: customers grouped by what brought their first order, how many bought again within a year, and what each spent by 30, 60, 90, 180 and 365 days after it. A horizon that no customer has reached yet is empty, not zero.

## Next steps

- [Shopify](/docs/sources/shopify)
- [Revenue tracking](/docs/learn/revenue-tracking)
- [UTM tags](/docs/learn/utm-tags)

Canonical address: https://nextanalytica.app/docs/learn/attribution
