Skip to content

Revenue attribution

Stripe revenue attribution: see which channel, page and post earned each payment

Stripe revenue attribution means connecting each payment in your Stripe account to the visit that led to it, so a sale is credited to a search, a newsletter, a referrer, a landing page or one specific post. Statsy does it with a small script and a signed Stripe webhook. No tag manager, no purchase events fired from the page.

Last updated

Stripe revenue attribution in Statsy

How payments arrive
A signed Stripe webhook, verified with the whsec_ signing secret you paste once
Events used
checkout.session.completed, invoice.paid, charge.refunded and customer.subscription.deleted
How a payment is matched
The visitor id in client_reference_id or metadata.statsy_vid, then email, then customer id
Models
Last touch, first touch, linear, time decay and position based, with a 1 to 365 day lookback
What you get
Revenue, customers, refunds and net revenue by source, campaign, referrer, landing page and post
Price
From $9 a month after a 14-day free trial. A card is required; cancel any time.

What is Stripe revenue attribution?

Stripe revenue attribution is the practice of crediting each Stripe payment to the marketing touches that came before it. Stripe knows the money and nothing about the visit. Your analytics knows the visit and nothing about the money. Attribution is the join between the two.

The Stripe dashboard answers “how much did we make?” perfectly well. It cannot answer “was that from the launch post or from search?”, because a Stripe payment carries no referrer, no UTM tags and no landing page. Most teams bridge that gap with a tag manager and an ecommerce event schema, which works until a refund arrives, a subscription renews, or someone pays from a link in an email client that strips parameters.

Doing it properly needs three things:

  1. A record of where each visitor came from, every time they arrive.
  2. A trustworthy record of each payment, including renewals and refunds.
  3. A reliable way to link the two, and a rule for splitting the credit.

How does Statsy connect Stripe payments to visits?

The script stores every visit that has a source as a touch. Checkout links carry the visitor’s anonymous identifier through to Stripe. When Stripe confirms the charge with a signed webhook, Statsy verifies the signature, matches the payment to that visitor and credits the touches before it.

The webhook

Stripe signs every event with a Stripe-Signature header containing a timestamp and an HMAC-SHA256 signature of the raw body, computed with your endpoint’s whsec_ secret. Statsy verifies both, and rejects anything outside a five-minute tolerance, which is what Stripe recommends against replay attacks.

Four event types are used. checkout.session.completed records a one-time payment, invoice.paid records a subscription renewal, charge.refunded records a refund as a negative amount, and customer.subscription.deleted marks the customer as churned. Each payment is stored once per Stripe event id, so Stripe’s automatic retries never double count.

The match

Stripe documents client_reference_id on a Checkout Session as “a unique string to reference the Checkout Session… used to reconcile the Session with your internal systems”, which is exactly what it is used for here. Statsy looks for the visitor identifier there first, then in metadata.statsy_vid, then falls back to the email address on the payment, then to a known customer id.

A payment that matches none of those still counts toward total revenue. It simply is not credited to a channel, and the reports say so rather than guessing.

How do you set up Stripe revenue attribution?

Three steps, and the middle one is copy and paste. Add the Statsy script to every page, connect Stripe by pasting a webhook URL into Stripe and its signing secret back into Statsy, then tag your campaign links. Hosted Stripe checkout links need no code change at all.

  1. Add the Statsy script, about 3 KB gzipped, to every page of your site.
  2. In the site’s integrations, choose Stripe. Copy the webhook URL into Stripe’s Webhooks settings, subscribe it to the four event types above, and paste the whsec_ signing secret back into Statsy.
  3. For Payment Links and hosted Checkout links placed on your site, nothing else is needed: the script appends the visitor identifier for visitors in Full mode.
  4. For Checkout Sessions created on your own server, pass statsy.visitorId() from the browser and set it as client_reference_id or metadata.statsy_vid when you create the session.
  5. Tag campaign links with UTM parameters, for example utm_source=newsletter&utm_campaign=launch. Referrers are recognised without any tagging.

Stripe references, checked September 2026: receiving webhook events and the Checkout Session object.

What do the reports actually show?

Revenue, customers, conversions, refunds, net revenue and revenue per customer, broken down by channel, source, campaign, referrer, landing page and individual post. You pick the attribution model and the lookback window, and the same numbers are available through the API, CLI and MCP server.

BreakdownWhat it answers
Channel and sourceWhich categories and specific sources produced paying customers, not just visits
CampaignWhich tagged campaign earned the money, with refunds subtracted
Landing pageWhich entry page tends to be the first step for buyers
PostsWhich exact post on X or LinkedIn sent visits, sign-ups and revenue, via its t.co or lnkd.in short link
Search queriesWhich Google queries earn, when Search Console is connected
Visitor journeysThe ordered touches and payments for one customer, so you can sanity-check the model

If you also want to watch what those buyers did on the page, session replays can be filtered to sessions that paid, and heatmaps can switch from clicks to revenue. That side of the product is covered on the Hotjar alternative page.

What are the limits of Stripe attribution?

Attribution is an estimate, here and everywhere else. Ad blockers, privacy settings and consent choices all reduce what can be measured. Cookieless visitors cannot be linked across days, so their payments count toward revenue but reach a channel only through an email or customer id match.

  • Payments made in a mobile app or by invoice outside the website have no visit to attribute unless the customer is matched by email.
  • Direct visits earn credit only when the buyer had no other source inside the lookback window, so returning customers do not erase the campaign that found them.
  • Statsy reads no ad spend, so it reports revenue but never return on ad spend.
  • Models are rules, not proof of cause. Compare two models and open a few real journeys before moving budget.

How do you try it on your own Stripe account?

Start the free trial, add the script, paste the Stripe webhook URL and signing secret, and let a day of traffic run. The first attributed payment usually lands within a day on a site with real sales. Everything is on during the trial, including replays and heatmaps.

The trial runs for 14 days with every feature enabled. A card is required at sign-up and nothing is charged until the trial ends; plans start at $9 a month and are priced by monthly events, so a small site stays small on the bill. Cancel in one click at any time, and analytics data is deleted 30 days after a cancellation. See pricing or read how the models split credit on marketing attribution software.

Stripe revenue attribution FAQ

Do I need to send purchase events from my website?

No, and you should not. Statsy counts revenue only from signed Stripe webhooks and the authenticated Payment API, because amounts reported from a browser can be forged by anyone who opens the console.

Does it handle subscription renewals and refunds?

Yes. Renewals arrive as invoice.paid events and count as revenue, refunds arrive as charge.refunded and reduce net revenue, and a deleted subscription marks the customer as churned in the reports.

What happens to payments Statsy cannot match to a visitor?

They still count toward total revenue, but they are not credited to any channel. The reports show unattributed revenue separately rather than spreading it across sources or quietly calling it direct.

Will this work with Stripe Payment Links?

Yes, when the link is on a page carrying the Statsy script and the visitor is tracked in Full mode. The script appends the visitor identifier to the link, and Stripe returns it in the webhook.

Is my Stripe API key needed?

No. Statsy never asks for a Stripe secret key and cannot read or change your Stripe account. It only receives webhooks and verifies them with the endpoint signing secret you paste in.

Does this work for visitors without cookies?

Partly. Cookieless visitors are counted and their payments count toward revenue, but crediting a channel needs a match by email or customer id, since cookieless visits cannot be linked across days.
Stripe revenue attribution · Statsy