What is revenue attribution, and how does it work?
By Devendra Variya, co-founder of Virling. Published 2026-11-02.
Revenue attribution is the practice of joining each payment to the website visits that came before it, so a business can see which marketing channel, campaign and page brought paying customers, not just visitors. It needs three parts: a visitor ID on every visit, that ID passed into checkout, and a rule for which visit gets the credit.
This page is the overview. Each section links to a guide or a docs page that goes deeper.
Why visitor counts are not enough
Traffic reports tell you which channel is loud. They do not tell you which one pays. A Reddit thread can send 2,000 visitors and no customers, while a single mention in a newsletter sends 40 visitors and three annual plans. Without attribution both look like a line on a traffic chart, and the bigger line wins your attention.
Attribution puts the money next to the visits. Once every payment carries the visit that led to it, you can compare channels by revenue and by revenue per visitor, which is the fair way to compare a big channel with a small one.
How revenue attribution works
Every tool that does this well follows the same three steps. Here is how they look in Virling.
1. A visitor ID on every visit
The tracking script sets one first-party cookie, virling_vid, with a random ID. Every pageview and goal is stored with that ID. Pageviews from one visitor form a session until 30 minutes pass with no event, and each session takes its channel, referrer, campaign and landing page from its first pageview. That first pageview is the session's touch. See how Virling works.
2. The ID goes into checkout
Your payment provider knows who paid but not where they came from. The bridge is the visitor ID: pass it into checkout, for example as client_reference_id on a Stripe Checkout Session or as virling_vid in metadata. Stripe Payment Links, Polar checkout links and Dodo Payments links need no code, because the script adds the ID to those links on the page. The details for each provider are in link checkout to visits, and the Stripe walkthrough is in how to track Stripe revenue by traffic source.
3. The payment join
Virling reads payments from Stripe, Paddle, Shopify, WooCommerce, Dodo Payments, Polar, LemonSqueezy, Creem or RevenueCat with a read-only key where the provider allows one. For each payment it takes the visitor ID that checkout carried, finds that visitor's sessions that started before the payment and inside the lookback window, picks one with the site's model, and credits the whole payment, after refunds, to that session's channel, referrer, campaign and landing page. It rebuilds this after every sync, so a new payment shows its channel within a minute or so.
Subscription renewals have no visit of their own. They take the attribution of the customer's first payment, so a customer who first came from Hacker News keeps counting toward Hacker News every month they renew. See renewals.
Attribution models and the lookback window
An attribution model is the rule that picks which visit gets the credit when a buyer visited more than once. Virling has three:
- Last non-direct, the default: the latest session in the window that was not Direct. Someone who found you on a forum and came back a week later by typing your URL is credited to the forum.
- First touch: the earliest session in the window. It shows which channels introduce people who later pay.
- Last touch: the latest session, Direct included. It shows how people arrive when they are ready to buy.
The lookback window sets how old a visit can be and still count: 30, 60, 90 or 365 days, 90 by default. Changing either setting recomputes history for the whole site, so you can switch back and forth and compare. The trade-offs for a small SaaS are in first-touch or last-touch attribution, and the settings are in model and lookback window.
What counts as a channel
Each session gets one of eight channels from its first pageview: Paid, Email, AI, Organic search, Communities, Social, Referral or Direct. A utm_medium of cpc or newsletter decides first, then the referrer host (reddit.com is Communities, chatgpt.com is AI), then utm_source when there is no referrer. Everything with no signal is Direct. The full rule order is in channels, and the tagging habits that keep it clean are in which UTM parameters to use.
Where attribution breaks
No setup matches 100% of revenue. The useful question is how much is matched and why the rest is not. Virling shows a Matched revenue line under the Overview numbers with the share of revenue tied to a visit and the reasons for the rest. The common gaps:
- No visitor ID reached checkout. The most common cause. A checkout created on your server that never reads the cookie, or a payment link opened from an email or a QR code, carries no ID. These payments still count toward revenue, as Unattributed.
- Cookieless tracking. Without a cookie there is no ID to pass, so new payments cannot be linked to visits at all. See cookieless analytics and revenue.
- Visits that were never tracked. Ad blockers, a page without the script, or a visitor with Global Privacy Control when you respect it.
- Visits outside the window. A buyer whose only visit was 120 days ago, with a 90-day window.
- Missing referrers. Links opened in some apps arrive with no referrer and no tag, and land in Direct. Virling credits known in-app browsers such as Instagram and LinkedIn to their app, but not every app names itself.
- Free trials. A trial starts with nothing charged, so there is no payment to carry the ID. For Stripe, Polar and Dodo Payments, Virling records the trial start and credits the first real charge to the visits before the trial began.
When checkout cannot carry the ID, Virling can also match Stripe payments by a hashed email sent after signup. Every cause and its fix is in Unattributed revenue.
Revenue attribution, subscription metrics and revenue intelligence
Three kinds of tools share the word revenue. Revenue attribution tools join payments to website visits. Subscription metrics tools such as MRR and churn dashboards read only billing data, so they cannot say where a customer came from. Revenue intelligence tools analyse sales calls and pipeline for sales teams. Many SaaS teams run a subscription metrics tool for finance and an attribution tool for marketing.
How to check your own setup
- Make a test payment from a page that runs the script.
- Wait for the next sync, about a minute.
- Open the payments list. The payment should show a channel instead of Unattributed.
- Open the payment to see its journey: the sessions before it, oldest first, with the credited one marked.
- Compare the month's total with your payment provider. They should match, because the revenue comes from the provider, not from browser events. If yours differ in another tool, this is why GA4 and Stripe disagree.
Read next
- How to find which marketing channel pays: the five-step setup and the weekly read.
- How long a visitor takes to become a customer: time to pay per channel.
- The best revenue attribution tools: seven tools compared on payment sync, self-hosting and price.
- How attribution works in the docs.
Frequently asked questions
What is revenue attribution?
Revenue attribution is joining each payment to the website visits before it, so you can see which marketing channel, campaign and page brought paying customers. It needs a visitor ID on every visit, that ID passed into checkout, and a model that picks which visit gets the credit.
What does revenue attribution mean in marketing?
It means crediting revenue, not clicks or signups, to the channel that brought the customer. A marketing team can then compare channels by revenue and revenue per visitor instead of by traffic.
What is the difference between first touch and last non-direct attribution?
First touch credits the earliest visit in the lookback window, the one that introduced the buyer. Last non-direct credits the latest visit that was not Direct, so a buyer who found you on a forum and later typed your URL is credited to the forum.
Why is some revenue unattributed?
Usually because no visitor ID reached checkout. Other causes are cookieless tracking, ad blockers, visits older than the lookback window and payment links opened outside your site. Unattributed payments still count toward total revenue.
Can I do revenue attribution without cookies?
Only partly. Without a cookie you can still count visits and channels, but there is no visitor ID to pass into checkout, so payments cannot be joined to visits. In Virling's cookieless mode new payments show as Unattributed.
Virling is open-source revenue attribution: self-host it free, or use the hosted version from $19 a month after a 14-day free trial. Start free trial, self-host it, or open the live demo.