See which channel brings your Dodo Payments subscribers.
For SaaS founders who sell subscriptions through Dodo Payments as their merchant of record. Virling ties each payment, the first charge after a trial and every renewal to the channel that brought the customer, so you compare channels by the customers who pay, not by signups. Open source under AGPL, hosted or self-hosted.
Dodo Payments is the merchant of record, so its dashboard shows the payment and the customer but not the post, search or ad that came first. Virling reads your Dodo account with an API key, never writes to it, and joins each payment to a visit through metadata.virling_vid. The attribution model explains which visit gets the credit.
Subscriptions with usage or add-ons
Dodo tags each subscription charge with its subscription ID, and Virling uses that: for a payment with one, it looks up the subscription's paid payments, and every payment after the first paid one is a renewal that keeps the channel of the customer's first payment.
- Fixed plans. The first paid payment is credited to its visit, and each billing cycle after it keeps that channel, matched by Dodo customer ID.
- Usage-based billing. Virling imports each successful payment at its total, whatever it is made of. A subscriber whose usage grows shows more revenue and net LTV under the channel that brought them, not under a new one.
- Add-ons and plan changes. A charge on the same subscription is a renewal too, so an add-on or an upgrade never counts as a new customer. With Only these product IDs filled in, list the subscription's product: a subscription payment counts for its subscription's product.
- Trials. A $0 subscription payment starts the trial and is never revenue. The first charge after it is the first payment, not a renewal, and when it has no visitor ID of its own it is credited to the visits before the trial.
- Failed renewals. Only succeeded payments are imported. While Dodo waits for a new payment method, the subscription is
on_holdand, likeactive, counts as still paying on Retention. - Refunds and disputes. A succeeded refund lowers its payment on that payment's date, and a lost or accepted dispute counts as a full refund.
See which channel brings your Dodo Payments subscribers
For SaaS founders who bill through Dodo Payments. 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 and put the script on every page where visitors arrive, including your app, then:
- Connect Dodo Payments. Create an API key in the Dodo Payments dashboard and paste it under payments. Live mode and test mode keys both work. The last 90 days are imported, then new payments every minute. If one Dodo account sells more than this product, list its product IDs under Only these product IDs.
- Pass the visitor ID at checkout. Static payment links on
checkout.dodopayments.com/buy/...need no code: keep the link as a normal<a href>on a page that runs the script, and the script addsmetadata_virling_vid=<visitor ID>, which Dodo stores as the payment'smetadata.virling_vid. For a checkout session you create on your server, setvirling_vidinmetadatafrom the cookie.
const session = await client.checkoutSessions.create({
product_cart: [{ product_id: "pdt_...", quantity: 1 }],
return_url: "https://yourproduct.com/thanks",
metadata: { virling_vid: req.cookies.virling_vid },
});
// Send the customer to session.checkout_urlThe full walkthrough is in how to track Dodo Payments revenue by traffic source, and Dodo Payments UTM tracking covers passing source data through checkout. Every setting is on the Dodo Payments integration page. To see what selling through a merchant of record costs, use the merchant of record fee calculator.
Which checkout carries the visitor ID
Virling reads metadata.virling_vid on the payment. How it gets there depends on how the customer reaches checkout.
| Checkout type | How the visitor ID travels | What to check |
|---|---|---|
| Static payment link on your page | The script adds metadata_virling_vid to links on checkout., and Dodo stores it as the payment's metadata. | The link is a normal <a href> on a page that runs the script. A parameter that is already there is not replaced |
| Checkout session from your server | Your server reads the virling_vid cookie and sets it in metadata | The request that creates the session comes from the customer's browser on your domain, so it has the cookie |
| Payment link URL built in code | Your code adds metadata_virling_vid from window.virling?.vid?.() | The value is there before you add it: it is empty when the script is blocked or not loaded yet |
| Test payment link | Your code adds metadata_virling_vid. The script does not add it to test links | The URL has the parameter before you pay |
| Payment link in an email or on another site | It does not travel. There is no script on that page to add it | Send people to your pricing page instead, and put the payment link there |
| Renewal charged by Dodo | Not needed. It keeps the channel of the customer's first payment | The first payment is in Virling and has a channel |
Make a test purchase
- Connect a test mode key. A site has one Dodo Payments connection, and test payments stay in your reports after you replace the key with a live one. To keep them out, connect the live key, make one small live payment and refund it. If Only these product IDs is filled in, add the test product's ID.
- Visit through a tagged link. Open a private window and go to a page that runs the script, such as
https://yourproduct.com/?utm_source=test&utm_medium=email. Use your real domain, notlocalhost, and a browser and IP address that Virling does not ignore. - Pay in the same window. Go to a test checkout your server creates with
metadata.virling_vid, or a test link withmetadata_virling_vidadded in your own code, and pay with a test card. Use a plan without a trial, since a trial start is not a payment. - Read the payment. Wait a minute for the next sync and open
/app/yourproduct.com/payments. The payment shows thetestsource and the Email channel instead of Unattributed. Open it: Visitor under Details is the visitor ID, and the journey starts at your tagged visit, not at checkout. - Test again with a new email address. A later payment by the same customer is a renewal and keeps the first payment's channel, so a second test with the same address proves nothing. Then replace the test key with the live one.
Why a Dodo payment is Unattributed
Open the payment and look for Visitor under Details. Without one, checkout did not carry the visitor ID.
- The checkout session had no
metadata.virling_vid. Fix: set it from the cookie on the request that creates the session. A session created by a background job has no cookie to read. - A payment link was opened from an email, a QR code or another site. Fix: link to a page that runs the script, and put the payment link there.
- A payment link URL was built in code. Fix: add
metadata_virling_vidyourself, or use a normal link. The code is in the Dodo Payments docs. - The visitor had no ID. The script was missing or blocked, or the site is in cookieless mode. Fix: put the script on every page where visitors arrive, and set Visitor cookie to Cookie and take
data-cookielessoff the tag. If you need consent first, use Until consent: visitors who accept can be credited. - It has a visitor ID but no visit in the window. Fix: choose a longer lookback window if your buyers take longer than 90 days.
- It is a renewal of an Unattributed first payment, or of one older than the import. Check the first payment, not the renewal. There is nothing to fix at checkout for a customer who already pays.
- It is from before the script was on your site. This covers most of the first import, and cannot be filled in later.
Dodo Payments payments are not matched by email. A fix applies to new customers; earlier payments usually stay Unattributed. More causes are in Unattributed revenue.
What to know
- Payments older than the 90-day backfill are not imported, so renewals of subscriptions that started before that are usually Unattributed. Channel numbers fill in as new customers arrive.
- To stay inside Dodo's limit of 240 requests per minute, Virling makes at most a couple of extra lookups per round, so a large backfill can take a few minutes to finish.
- Renewals keep the channel of the customer's first payment. If that one is Unattributed, a renewal falls back to its own visitor ID, which renewals rarely carry. Other payments without a visitor ID still count toward revenue, as Unattributed, unless they follow a trial that was credited.
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. In a load test on 2026-10-31, in a container limited to one vCPU and 1 GB of RAM, it ingested 100,000 pageviews at 2,829 a second with none failed and a p99 of 34 ms, and used 157 MB of memory after the ingest.
Frequently asked questions
Which channel brings my Dodo Payments subscribers?
Connect Dodo Payments to Virling with an API key and pass the visitor ID in the payment metadata; static payment links on checkout.dodopayments.com get it from the script automatically. Each customer's first payment is credited to the visits before it, and every renewal keeps that channel, so the Channels card and the Retention page show which channels bring subscribers who pay.
How are Dodo Payments renewals attributed?
Any payment after a customer's first one is a renewal, and so is a payment that belongs to a subscription that already had a paid payment before it. It takes the channel, referrer, campaign and landing page of the customer's first payment, matched by Dodo customer ID. Any later subscription payment, including a plan change, keeps that channel.
What about free trials on Dodo Payments?
A $0 subscription payment starts a trial. Virling never counts it as revenue, a payment or a customer. The first charge after the trial counts as the first payment, and when it has no visitor ID of its own it is credited to the visits before the trial started.
Does Virling change anything in my Dodo Payments account?
No. Virling only reads payments, refunds and subscriptions, and never creates, changes or refunds anything. Live mode and test mode keys both work.
How is a Dodo Payments subscriber who cancels and comes back credited?
To the channel of their first payment, however long they were away, when they return with the same Dodo customer ID. The channel that brought them back is not credited, unless the first payment is Unattributed and the new one has its own visitor ID. With a new customer ID they are a new customer, credited from their own visits.
Are Dodo usage charges and add-ons credited to the first channel?
Yes. Virling imports each successful Dodo payment at its total, and a payment on a subscription that was already paid once is a renewal. Usage billed for the period and add-ons charged on the subscription keep the channel of the customer's first payment. If you filter by product, list the subscription's product ID.
What about Dodo Payments subscriptions that began before Virling was connected?
Virling imports payments from the last 90 days. When a subscription's first payment is older than that, its earliest payment in Virling stands in, and it rarely has a visit, so its renewals are usually Unattributed. A first payment inside the 90 days but from before the script was on your site is usually Unattributed too. Every imported payment counts toward revenue.
Full guides: Set up Virling for a SaaS product, Dodo Payments in the docs and Renewals.