Track Stripe course sales by traffic source.
For course creators who sell with Stripe Checkout or Payment Links. Virling ties each course sale, payment plan and refund to the channel and campaign that brought the student, so you see which video, webinar, email or lead magnet sells, not just which one gets clicks. Open source under AGPL, hosted or self-hosted.
Stripe knows who bought the course, but not the video, webinar or email that brought them. Virling joins the two: a visitor ID set when someone lands on your site, carried into Stripe at checkout, and matched to that visitor's visits when the charge comes in.
What you get
- Each course sale credited to a channel and campaign. Every visit gets one channel, such as Paid, Email, Organic search, Social or Referral, plus its source, UTM campaign and landing page. By default a sale is credited to the latest visit in the last 90 days that was not Direct.
- Payment plans that keep the first channel. When a plan is billed as a Stripe subscription, a charge whose invoice has billing reason
subscription_cycleis a renewal. It copies the channel, referrer, campaign, landing page, country and device of the student's first payment, matched by Stripe customer ID. - Refunds and disputes. Refunds, lost disputes and late settlements update sales that were already imported, so a channel whose students ask for their money back shows it.
- Revenue per visitor by channel. The Channels card shows visitors, revenue and revenue per visitor for each channel, and its Source and Campaign tabs show the sites, emails and videos behind it.
- Every sale and its journey. The payments list shows each sale with the channel it was credited to. Open one to see the visits before it.
See which video, email or webinar sold your course
For course creators who sell through Stripe. Virling is open source under AGPL: self-host it free, or use the hosted version with a 14-day free trial.
Set it up
- Add the site. Click + Add a site and enter the domain of your sales page, such as
yourcourse.com, and its timezone. - Install the script. Paste the tag before
</head>on every page, including the sales page with your buy button. Leave cookieless mode off: without thevirling_vidcookie there is no visitor ID for the sale to carry. - Connect Stripe. Create a restricted key with Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents, and paste it under payments. Secret keys are refused. The last 90 days are imported, then new payments every minute.
- Let the visitor ID reach checkout. Payment Links on
buy.stripe.comneed no code: the script adds the ID to normal links on your pages. Stripe Payment Link UTM tracking has a test to run. For Checkout Sessions you create on your server, setclient_reference_idto thevirling_vidcookie, or usemetadata.virling_vidif you already use that field. - Tag the links you share. Use one
utm_campaignper YouTube video, per webinar and per lead magnet; each guide has the tags. Launches, cohort deadlines and affiliates are covered in revenue attribution for online courses.
await stripe.checkout.sessions.create({
mode: "payment", // "subscription" for a payment plan
client_reference_id: req.cookies.virling_vid,
// ...
});A launch, worked through
These numbers are made up, to show how to read the report. They are not from a real course and not a benchmark. A $200 course opens for one week, sold through a webinar, YouTube videos, ads and partner links:
| Channel | Visitors | Sales | Revenue | Revenue per visitor |
|---|---|---|---|---|
| 800 | 24 | $4,800 | $6.00 | |
| Social | 2,400 | 12 | $2,400 | $1.00 |
| Paid | 1,500 | 6 | $1,200 | $0.80 |
| Referral | 500 | 5 | $1,000 | $2.00 |
| Direct | 800 | 3 | $600 | $0.75 |
| Unattributed | - | 4 | $800 | - |
| Total | 6,000 | 54 | $10,800 | $1.80 |
In this example each visitor is counted under one channel, so the rows add up, and no sale is refunded. Social sent three times the visitors of Email and half the revenue, so a visitor from Email was worth six times as much. The four Unattributed sales came from a Payment Link opened straight from an email. By default a buyer who found you on YouTube and paid after a follow-up email counts as Email; first touch credits the video instead. Webinar revenue tracking has the tags for the registration, follow-up and replay links.
What to know
- Payment Links opened from emails, QR codes or other sites carry no visitor ID and show as Unattributed. Send people to your sales page first and let them click through from there.
- If checkout runs on a page you cannot add the script to, or on a custom checkout domain instead of
buy.stripe.com, the script cannot add the ID. - Sales without a visitor ID still count toward revenue, as Unattributed. Sending the buyer's email as an
identifyevent, for example when they register for a webinar, lets a later Stripe payment with the same email be matched by email. - Charges older than the 90-day backfill are not imported, so installments of plans that started before that are Unattributed.
- Installments taken as separate one-off payments are not renewals, and payments without a customer ID cannot be linked to a first payment.
- Virling does not read which product a charge was for, so it does not split revenue by course.
- Someone who watches on a phone and buys on a laptop is two visitors.
- On the Retention page a student who pays once counts toward 30-day churn. For one-time courses, look at revenue and refund rate instead.
Open source
Virling is open source under AGPLv3, and the code is on GitHub. Use the hosted service, or self-host it as one binary with every feature.
Frequently asked questions
Which channel sells my course on Stripe?
Connect Stripe to Virling with a read-only restricted key and let the visitor ID reach checkout. Each course sale is credited to the visits before it, and the Channels card shows visitors, revenue and revenue per visitor for every channel, source and campaign.
How do I track course sales by traffic source with Payment Links?
Put the Virling script on your sales page and link to buy.stripe.com with a normal link. The script adds client_reference_id with the visitor ID, unless the link already has one, and Stripe copies it onto the Checkout Session. Links opened from emails, QR codes or other sites carry no visitor ID.
How are course payment plans attributed?
If the plan is a Stripe subscription, each later installment is a charge whose invoice has billing reason subscription_cycle. Virling marks it as a renewal and gives it the channel and campaign of the student's first payment, matched by Stripe customer ID. Installments taken as separate one-off payments are not renewals, so each one needs its own visitor ID.
Are course refunds and disputes counted?
Yes. Virling reads Stripe events for refunds and lost disputes and updates sales it has already imported, so revenue is shown after refunds and stays on the channel that brought the student.
Can Virling show revenue for each course?
Not by product. Virling reads Stripe charges and does not read which product was sold. If you sell several courses on one site, give each course its own campaign on the links you share, and the Campaign tab shows the revenue each campaign brought.
Does Virling need write access to Stripe?
No. It asks for a restricted key with Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents, and refuses secret keys.
Full guides: Stripe in the docs, Link checkout to visits and Renewals.