Revenue
How to attribute revenue to traffic sources: first touch vs last touch
First touch, last touch and multi-touch attribution in plain terms, with a worked example and how to join a payment to the visit that caused it.
The CrispStats team · · Updated · 7 min read
In short
To attribute revenue to a traffic source you need two things: a rule for who gets the credit, and a way to join each payment to a visit. First touch credits the source that introduced the customer, last touch credits the source of the visit that ended in payment. The join is done by passing an anonymous visitor id into your checkout as metadata, so the payment webhook can carry it back to your analytics.
Traffic reports tell you where visitors come from. Payment reports tell you how much money arrived. Neither tells you which visitors paid, and that is the question you actually have when you decide where to spend next month’s time or budget.
Revenue attribution closes that gap. It has a simple part (the bookkeeping rule) and a fiddly part (the plumbing). This guide covers both.
What is revenue attribution?
It is the practice of assigning each payment to the traffic source, campaign or page that led to it. The output is a table where every source has not only visitors but revenue next to it, and from those two numbers a revenue per visitor.
The rule that decides who gets the credit is the attribution model. There are three families worth knowing.
First touch, last touch and multi-touch: what is the difference?
First touch
First touch gives all the credit to the source of the customer’s first known visit. It answers “what introduces us to people who end up paying?” It favours discovery channels: search, social posts, a mention in an AI assistant, a podcast.
Last touch
Last touch gives all the credit to the source of the visit in which the payment happened. It answers “what was the final push?” It favours closing channels: email, branded search, retargeting ads, and direct visits from people who typed your address.
Multi-touch
Multi-touch models split the credit across every known visit: evenly (linear), weighted toward the most recent (time decay), or weighted toward the first and last (position based). They sound fairer. In practice they need a long, reliable history per person, and the weights are a choice, not a measurement.
| Model | Credit goes to | Good for | Blind spot |
|---|---|---|---|
| First touch | The first known source | Judging discovery channels | Ignores what closed the sale |
| Last touch | The source of the paying visit | Judging closing channels | Over-credits direct and email |
| Multi-touch | Every known visit, by a weight | Long sales cycles with logins | Needs identity across visits; weights are arbitrary |
A worked example
Say one customer takes this path to a $49 purchase:
- Monday: finds a blog post through Google and leaves.
- Wednesday: clicks a link in your newsletter, reads the pricing page, leaves.
- Friday: types your address, signs up and pays $49.
| Model | Organic search | Direct | |
|---|---|---|---|
| First touch | $49 | $0 | $0 |
| Last touch | $0 | $0 | $49 |
| Linear multi-touch | $16.33 | $16.33 | $16.33 |
Same customer, same money, three different stories. None is wrong. Last touch here says “direct” earned $49, which tells you nothing you can act on. First touch says the blog post did, which is at least a decision: write more of those. That is why many small teams start with first touch and look at last touch as a second opinion.
How do you connect a payment to a visit?
This is the plumbing. Your analytics knows the visitor as an anonymous id. Your payment provider knows the customer as an email and a charge. Something has to carry the first id into the second system. The reliable way is checkout metadata.
- Read the visitor id in the browser just before you start the checkout.
- Send it to your server with the checkout request.
- Attach it to the checkout as metadata or a client reference when you create the session with your payment provider.
- Let the webhook bring it back. When the payment succeeds, the provider’s webhook includes the metadata, and your analytics can file the payment under the right visit and source.
With CrispStats the first two steps look like this:
// In the browser, when the visitor clicks "Buy"const visitorId = await crispstats.id();await fetch("/api/checkout", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ plan: "pro", visitorId }),});And on the server, using Stripe Checkout as the example:
// On your serverconst session = await stripe.checkout.sessions.create({ mode: "subscription", line_items: [{ price: PRICE_ID, quantity: 1 }], client_reference_id: visitorId, metadata: { crispstats_visitor_id: visitorId }, success_url: "https://example.com/welcome", cancel_url: "https://example.com/pricing",});Other providers have the same idea under different names: custom data, metadata, passthrough. Whichever you use, the pattern does not change. The id travels with the checkout and returns with the webhook, so no personal data has to be matched by hand.
What goes wrong in practice?
- The payment page becomes the source. A customer leaves your site for a hosted checkout and returns to a thank-you page. If your tool treats that return as a new visit, the payment provider’s domain shows up as a top “referrer” and steals the credit. Attribute to the visit that started the checkout, not the one that came back from it.
- Cross-device and cross-day paths. Someone who discovers you on a phone and buys on a laptop a week later looks like a direct visitor who paid at once. Identifying logged-in users with your own user id narrows this gap; nothing closes it fully.
- Renewals. A subscription’s second invoice has no visit behind it. Decide once whether renewals inherit the source of the original purchase (useful for lifetime value by channel) or are reported separately (useful for judging this month’s marketing). Keep new and renewal revenue as separate lines either way.
- Refunds. Record them as negative payments against the same source, on the date they happened. Deleting the original payment rewrites history and makes last month’s report change under you.
- Untagged campaigns. A newsletter click with no UTM parameters often arrives with no referrer and is filed as direct traffic. Tag your own links; the UTM builder takes a minute.
- Counting your own tests. Test purchases and staff visits inflate small numbers quickly. Exclude your own browser and use the provider’s test mode.
Which model should you use?
Pick the model that matches the decision. If you are choosing where to find new customers, use first touch. If you are tuning the final step (pricing page, email sequence, checkout), look at last touch. If the two disagree wildly for a channel, that is information: the channel either opens doors or closes sales, rarely both.
Whatever you choose, compare channels on revenue per visitor rather than total revenue. A source with 200 visitors and $600 in sales ($3.00 per visitor) deserves more attention than one with 5,000 visitors and $1,000 ($0.20 per visitor). The revenue per visitor calculator shows what a small lift is worth.
Which rule CrispStats uses, and why
CrispStats uses first touch, and only first touch, because the decision most small teams bring to revenue data is the first one above: where to find the next customers. It does not show a last-touch view, so for tuning the final step you need another report. Revenue attribution works through webhooks from Stripe, Lemon Squeezy, Polar, Paddle, Dodo, Creem, Razorpay and RevenueCat, or through a server-side payment API if you bill another way. You pass the visitor id into checkout metadata as shown above. When the payment arrives it is filed under the first touch known for that visitor: source, channel, campaign and landing page.
Because visitors are recognised by a hash that rotates daily, “first touch known” means the first visit that can be connected to the payer. A purchase made on the day of the first visit is credited to that visit’s source. Refunds are listed as negative payments, and new and renewal revenue are reported as separate figures. The customer’s email address is never stored. Setup steps for each provider are in the revenue docs.