Skip to content

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.

Multi-touch
ModelCredit goes toGood forBlind spot
First touchThe first known sourceJudging discovery channelsIgnores what closed the sale
Last touchThe source of the paying visitJudging closing channelsOver-credits direct and email
Multi-touchEvery known visit, by a weightLong sales cycles with loginsNeeds identity across visits; weights are arbitrary

A worked example

Say one customer takes this path to a $49 purchase:

  1. Monday: finds a blog post through Google and leaves.
  2. Wednesday: clicks a link in your newsletter, reads the pricing page, leaves.
  3. Friday: types your address, signs up and pays $49.
A worked example
ModelOrganic searchEmailDirect
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.

  1. Read the visitor id in the browser just before you start the checkout.
  2. Send it to your server with the checkout request.
  3. Attach it to the checkout as metadata or a client reference when you create the session with your payment provider.
  4. 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.

Guide questions. Straight answers.

What people ask after reading this.

  • Neither is better in general. First touch shows which sources introduce future customers, so it suits decisions about where to find new people. Last touch shows what was happening when they paid, so it suits decisions about the final steps. Many teams read both.

  • No. The join between a visit and a payment is made by passing an anonymous visitor id into the checkout as metadata and reading it back from the payment webhook. That works without storing anything on the visitor's device, within the period the id stays valid.

  • Usually because the paying visit had no referrer: the customer typed the address, used a bookmark, clicked an untagged link in an email or app, or returned on a different day or device. Tagging your own links with UTM parameters and crediting the first known touch both reduce it.

  • As negative payments on the date of the refund, credited to the same source as the original payment. That keeps past periods stable and lets net revenue by channel add up.

Not answered here? Write to hello@crispstats.com

Go further

Free tools

  • Revenue per visitor calculator

    Enter visitors, conversion rate and average order value to get revenue per visitor, monthly revenue, and what a 10% improvement is worth.

  • UTM builder

    Build UTM-tagged links one at a time or in bulk from pasted rows, with presets, checks for capitals and spaces, CSV export and a channel preview.

  • Traffic source classifier

    Paste a referrer or a tagged link and see the channel and source a visit is filed under, with the rule that decided it.

Use cases

  • CrispStats for SaaS

    See which channels bring paying customers, where trials stall in the funnel, and how your app performs for real users, from one cookieless script.

  • CrispStats for ecommerce

    Tie orders to the campaign, page and source they came from, find where checkout loses people, and watch page speed, without cookies.

  • CrispStats for indie hackers

    Traffic, revenue by source, uptime and errors for every side project in one dashboard.

Your traffic, crisp and clear

One script, no cookies, and every feature from the first day. Set up takes about as long as pasting a snippet.