Which analytics tool connects website visits to Stripe revenue?
By Devendra Variya, co-founder of Virling. Published 2026-12-02.
Virling connects website visits to Stripe revenue. Its script gives every visitor an ID, Stripe checkout carries that ID, and Virling reads your charges with a read-only restricted key and joins each one to the visits before it. The dashboard then shows revenue and revenue per visitor for every channel, referrer, campaign and landing page.
Stripe knows who paid and how much, but not which post, search or ad brought them. Web analytics knows the visit, but not the payment. The join between the two is the part that answers which marketing pays.
Connect Stripe to your visits in five steps
- Add the script before
</head>on every page. It sets one first-party cookie,virling_vid, which is the visitor ID checkout will carry. See the script. - Create a restricted key in Stripe under Developers, API keys, with Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents. Paste it in Virling under Setup, Connect payments. Secret keys are refused. Virling imports the last 90 days, then checks for new charges every minute, and never creates, changes or refunds a payment.
- Pass the visitor ID at checkout. Payment Links on
buy.stripe.comneed no code: the script addsclient_reference_idto them. For a Checkout Session your server creates, setclient_reference_idto thevirling_vidcookie, or put it inmetadata.virling_vidon the session or the PaymentIntent. - Test it. With an
rk_test_key, visit your site through a tagged link, pay with a Stripe test card, wait a minute and open Payments. The payment should show a channel instead of Unattributed. See test your setup. - Read the answer. On the Channels card, each channel has visitors, revenue and revenue per visitor. The Source tab splits that by referring site, the Campaign tab by
utm_campaignand tracked link, and the Pages card shows the landing page and the last page before paying. Open any payment to see the visits before it and which one got the credit.
The script tag, on every page:
<script defer src="https://app.virling.com/v.js" data-site="yourdomain.com"></script>
A Checkout Session that carries the visitor ID:
const session = await stripe.checkout.sessions.create({
client_reference_id: req.cookies.virling_vid,
line_items: [{ price: "price_...", quantity: 1 }],
mode: "subscription",
success_url: "https://yourdomain.com/thanks",
});See your Stripe revenue by channel
Virling reads Stripe with a read-only key and joins each charge to the visit before it. Self-host it free, or use the hosted version.
What Virling reads from Stripe
- Charges, back 90 days on the first run. Charges from before the script was on your site count as revenue but have no visit to join, so they are Unattributed.
- Refunds and lost disputes, which lower the revenue of the charge they belong to.
- Renewals. A renewal has no visit of its own, so it keeps the channel of the customer's first payment. See renewals.
- Trials. When a free trial started through Checkout after you connected, the first charge is credited to the visit before the trial.
By default a payment is credited to the latest visit in the last 90 days that was not Direct. You can switch to first touch or last touch in Site settings. See model and lookback window, and Stripe in the docs for every field Virling reads.
Doing it without Virling
You can make the same join by hand. Save the UTM tags and the landing page in a first-party cookie when a visitor arrives, copy them into metadata on the Checkout Session, then export your Stripe payments each month and group them by those fields in a spreadsheet. That works for a few dozen payments. It misses Payment Links unless you add the tags to each link yourself, renewals carry no metadata unless you copy it from the first payment, and refunds need a second export. For the full walk-through, read how to track Stripe revenue by traffic source.
More on the Stripe side: Stripe client_reference_id, Stripe Payment Links UTM tracking and the Stripe integration.
Frequently asked questions
Does Virling need my Stripe secret key?
No. It asks for a restricted key with read access, starting with rk_live_ or rk_test_, and refuses secret keys.
Do Stripe Payment Links work?
Yes, when the link is a normal link on a page that runs the script. The script adds client_reference_id with the visitor ID. Links opened from emails, QR codes or other sites carry no visitor ID and show as Unattributed.
How are Stripe subscription renewals credited?
Each renewal, and any later charge of the same customer, keeps the channel of that customer's first payment, so the channel that won the customer keeps its credit.
Can I connect Stripe payments from before I added the script?
They are imported, 90 days back, and count toward revenue. There are no visits to join them to, so they show as Unattributed.
Does it work in Stripe test mode?
Yes. Connect a key that starts with rk_test_ and Virling reads test charges and refunds.
See which visits turn into Stripe revenue
Virling is open source under AGPL. Self-host it free, or use the hosted version; see pricing. It connects to Stripe, Paddle, Shopify, WooCommerce, Polar, LemonSqueezy, Dodo, Creem and RevenueCat.