See which channel sells your ebooks, templates and courses on LemonSqueezy.
For creators who sell ebooks, templates, courses and other digital products through LemonSqueezy. Virling ties each payment to the channel and campaign that brought the buyer, so you see which launch post, newsletter or creator brought the money, not just the clicks. Open source under AGPL, hosted or self-hosted.
LemonSqueezy records who bought and how much, but not the visit that brought them. A launch post, a newsletter mention or a creator's video sends a wave of visitors, and a few of them buy. Virling joins the two through the visitor ID the script passes into checkout.
What you get
- Each sale credited to a channel and campaign. Orders are imported and joined to the visits before them. Every visit gets one channel from its first pageview: Paid, Email, AI, Organic search, Communities, Social, Referral or Direct. By default a payment goes to the latest visit in the last 90 days that was not Direct.
- Revenue per source, campaign and landing page. The dashboard lists visitors, revenue and revenue per visitor for each channel, source, campaign and landing page, so a post that sent many visitors and no sales stands apart from a small one that paid.
- Newsletters and creators measured by sales. Hacker News, Reddit, Product Hunt and Indie Hackers count as Communities, and a link tagged
utm_medium=newslettercounts as Email. Give each sponsor or creator a tagged link and compare them by revenue. - Refunds taken off. Refunds do not change an order's creation time, so Virling rescans the last 60 days for refunds every 6 hours.
- Time to pay. The Time to pay card shows the median time from first visit to first payment per channel, so you see how long buyers from each channel take to decide.
Set it up
- Add the site. Click + Add a site and enter your domain, such as
yourstore.com, and its timezone. - Install the script. Paste the tag before
</head>on every page that links to your LemonSqueezy checkout. Leave cookieless mode off, since checkout needs the visitor ID. - Connect LemonSqueezy. In LemonSqueezy, open Settings, API, create a key and paste it under payments. LemonSqueezy keys cannot be made read-only and cover every store on your account; Virling only reads orders, subscriptions and subscription invoices, adds one webhook to each store, and stores the key encrypted. The last 90 days are imported, then new orders every minute.
- Link checkout to visits. LemonSqueezy returns custom data only in webhooks, so Virling registers one for
order_createdandsubscription_payment_successwhen you connect. Checkout links onSTORE.lemonsqueezy.comneed no code: the script addscheckout[custom][virling_vid]to them. For a checkout you create on your server withPOST /v1/checkouts, setdata.attributes.checkout_data.customto{ "virling_vid": "<the visitor's virling_vid cookie>" }. For a checkout URL you build in the browser:
const url = new URL("https://STORE.lemonsqueezy.com/checkout/buy/VARIANT_ID");
const vid = window.virling?.vid?.();
if (vid) url.searchParams.set("checkout[custom][virling_vid]", vid);
location.href = url.href;Make a test purchase from a page that runs the script, wait for the next sync, and the payment shows a channel instead of Unattributed. The full walkthrough is in how to track LemonSqueezy revenue by traffic source, and LemonSqueezy UTM tracking covers tagging links so each order shows its campaign. To compare order size across channels, use the average order value calculator. Every setting is on the LemonSqueezy integration page, and other providers are on revenue attribution for digital products. If you sell licenses that renew, see LemonSqueezy for plugin and theme makers.
Which LemonSqueezy sales can be linked
| What you do | Can the sale be linked? | Why, or what it takes |
|---|---|---|
| Post a link to your sales page | Yes | The visit is recorded with its channel. The buyer then clicks your checkout link, which carries the visitor ID |
| Post a checkout link itself, in a post, a bio or a DM | No | It opens without your page, so no visitor ID is added |
| Email a link to your sales page | Yes | Add utm_medium=email so the visit counts as Email |
| Email a checkout link | No | Link the email to your sales page instead |
| Put a checkout link on your own site | Yes | A normal <a href> to STORE. on a page that runs the script. No code |
| Build the checkout in your own code | Yes, if you pass the ID | virling_ in the checkout custom data. A store on a custom domain needs this too, since the script only adds the ID to *. |
| Let people buy from your LemonSqueezy store without visiting your site | No | There is no visit to credit |
| List the product on a marketplace | Only if the listing sends buyers to your site and they pay through your LemonSqueezy checkout | A sale the marketplace bills itself does not pass through your LemonSqueezy checkout, so it is not in Virling |
A LemonSqueezy sale that is not linked still counts toward revenue, as Unattributed. A linked sale also needs the webhook, so connect on a public https:// address first. A later order by the same customer keeps the channel of their first order, whichever link they used.
An example, with made-up numbers
These numbers are invented to show how to read the Channels card. A writer sells one $25 ebook through LemonSqueezy for a month, with no refunds:
| Made up | Visitors | Sales | Revenue | Revenue per visitor |
|---|---|---|---|---|
| Communities | 2,000 | 16 | $400 | $0.20 |
| 250 | 15 | $375 | $1.50 | |
| AI | 100 | 4 | $100 | $1.00 |
Communities and Email sold almost the same number of ebooks, but Email did it with an eighth of the visitors, so one Email visitor was worth 7.5 times as much. The next hour is better spent on the newsletter than on another launch post. AI looks strong at $1.00, but that rests on 4 sales: two fewer and it would be $0.50. Wait for more sales before ranking it.
What to know
- Sales made before the visitor ID was passed into checkout are Unattributed. They still count toward revenue.
- A buyer who pays from a link in an email or a DM, without visiting your site first, has no visit to credit and is Unattributed.
- Checkout links must be normal
<a href>links on a page that runs the script. - If you self-host, the webhook needs
VIRLING_BASE_URLto be a publichttps://address that LemonSqueezy can reach. Without one, no webhook is registered and LemonSqueezy payments show as Unattributed.
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
How do I see LemonSqueezy sales by traffic source?
Connect LemonSqueezy to Virling with an API key and add the Virling script to your site. Checkout links on your LemonSqueezy store need no code: the script adds the visitor ID as checkout custom data, and Virling reads it from a webhook. Each sale is then credited to the visit before it, with its channel, source, campaign and landing page.
Do I need to write code for LemonSqueezy checkout links?
No. Normal links to STORE.lemonsqueezy.com on a page that runs the script get checkout[custom][virling_vid] added when the page loads and when a visitor clicks. Only a checkout you create on your server with POST /v1/checkouts needs the visitor ID set in checkout_data.custom.
Which newsletter or creator brought a sale?
Tag the link you give them with utm_source and utm_medium=newsletter, or make a tracked link. Every visit gets a channel, source and campaign from its first pageview, so the Source and Campaign tabs show revenue per newsletter, creator or post.
Does the LemonSqueezy API key have to be read-only?
LemonSqueezy API keys cannot be made read-only and cover every store on your account. Virling reads orders, subscriptions and subscription invoices, adds a webhook to each store, and stores the key encrypted. Delete the key in LemonSqueezy at any time to revoke access.
What happens when a LemonSqueezy buyer comes back for a second product?
The later order keeps the channel of their first order, matched by the LemonSqueezy customer ID, so the link that brought them back is not credited. If the first order is Unattributed, the later one is credited from its own visitor ID when it has one.
Full guides: LemonSqueezy in the docs, Link checkout to visits and Tracked links.