virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
integrations / lemonsqueezy for saas

See which channel brings your LemonSqueezy subscribers.

For software sold as subscriptions or license keys with LemonSqueezy as merchant of record. Virling credits each order, and every subscription invoice after it, to the channel the customer first arrived from, so channels are ranked by who pays rather than who signs up. AGPL open source, on our servers or yours.

Start free trial See the demo

LemonSqueezy keeps the order, the tax it collected and the subscription. The Reddit thread, newsletter or search result that brought the buyer is not in it, and a renewal months later happens without any visit to your site. Virling links the two through the visitor ID your checkout carries in its custom data.

What you get

  • A source on every order. Orders and subscription invoices are imported and matched to the buyer's earlier visits. The default model takes the most recent visit within 90 days that was not Direct; buyers who evaluate for weeks can be read with first touch or a 365-day window.
  • Subscription invoices on the first order's channel. Invoices with billing reason renewal or updated inherit channel, referrer, campaign, landing page, country and device from the customer's first order, found by LemonSqueezy customer ID.
  • Refunds caught by a rescan. A refund leaves an order's creation time unchanged, so every 6 hours Virling reads the last 60 days of orders and invoices again to pick it up.
  • Retention and MRR by source. Retention groups customers by the channel of their first order, with still paying, net LTV and 30-day churn. Once an hour Virling reads each subscription's status and price: on_trial, active and past_due count as paying, and so does cancelled until its ends_at.
  • Revenue per visitor and time to pay. Compare channels by revenue per visitor, and wait for the median on Time to pay before you write one off.

See which channel brings your LemonSqueezy subscribers

For software founders who sell through a LemonSqueezy store. The code is AGPL: run it yourself for nothing, or start on the hosted version with 14 days free.

Start free trial See the demo

Set it up

  1. Register the domain. Choose + Add a site, enter the domain, say yourproduct.com, and set its timezone.
  2. Load the script everywhere buyers go. Add it to the <head> of your marketing pages and your app. One virling_vid cookie covers yourproduct.com and app.yourproduct.com, because it is set on the registrable domain. Cookieless mode stays off.
  3. Paste a LemonSqueezy API key. Create it under Settings, API and add it under payments. Virling imports the last 90 days, then new orders and invoices every minute, and adds its webhook to your stores, as described below.
  4. Carry the visitor ID through checkout. Checkout links on STORE.lemonsqueezy.com need nothing. For a checkout your server creates with POST /v1/checkouts, put { "virling_vid": "<the visitor's virling_vid cookie>" } in data.attributes.checkout_data.custom. For a checkout URL built 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;

Read how to track LemonSqueezy revenue by traffic source for the long version, and LemonSqueezy UTM tracking for tagging links so each order names its campaign. The merchant of record fee calculator shows what selling through LemonSqueezy costs, and the LemonSqueezy integration page lists every setting.

Checkout custom data, license keys and the store webhook

  • Custom data is the carrier. On a page that runs the script, a link to STORE.lemonsqueezy.com gets checkout[custom][virling_vid] added when it is clicked. LemonSqueezy keeps that custom data with the order but returns it only in webhooks, never in the API Virling polls, so an order seen only through the API has no visitor ID.
  • The store webhook Virling adds. When you connect, Virling creates one webhook on every store the key can see, for order_created and subscription_payment_success, pointing at /api/webhooks/lemonsqueezy/ on your Virling address. Its signing secret is stored encrypted, and each delivery must match its X-Signature before a visitor ID is attached. Connecting again with a new key updates that webhook instead of adding a second one; Disconnect leaves it in LemonSqueezy, so delete it there too.
  • Why the key has full access. LemonSqueezy API keys cannot be limited to reading and cover every store on the account. Virling uses it to read orders, subscription invoices, subscriptions with their prices and store currency, and to add the webhook, and it stores the key encrypted. Deleting the key in LemonSqueezy revokes access.
  • License keys. When a product generates license keys, LemonSqueezy issues one with the order. Virling reads the order that paid for the key, not the key, so activations and validations are not imported, and a key sold on its own is credited by its order like any other. While its subscription keeps the key active, each renewal invoice keeps the order's channel.
  • Tax is included. Virling records an order's total as LemonSqueezy reports it, with the VAT or sales tax it collected as merchant of record. A refund lowers that same total.
  • Self-hosting. The webhook needs VIRLING_BASE_URL to be a public https:// address. Without one no webhook is registered, and every LemonSqueezy payment is Unattributed.

Example: one LemonSqueezy subscriber

A made-up buyer with invented numbers, to show how each LemonSqueezy payment lands in Virling.

DayWhat LemonSqueezy recordsWhat Virling shows
0Nothing yet: the visitor follows a link in a Reddit thread to your landing pageA visit from Reddit, in the Social channel
2The visitor starts a 14-day free trial of the $20 a month plan through the checkout link on your pricing page. Nothing is charged; the order and an on_trial subscription are created, and the order_created webhook carries the visitor IDA $0 order credited to Reddit, the customer's first payment in Virling. Virling keeps no separate trial start for LemonSqueezy, so this order is what links the trial to the visit
16The trial ends and LemonSqueezy charges $24, the $20 plan plus 20% VAT for an EU buyer, on a subscription invoice with billing reason renewalA $24 payment, tax included, marked as a renewal and credited to Reddit through the customer ID of the day 2 order
46The next monthly invoice, $24 again, billing reason renewalA second $24 renewal credited to Reddit
50You refund $12 of the day 46 invoiceWithin 6 hours, the day 46 payment shows as partially refunded, on day 46. Reddit now has $48 of payments from this customer, $12 of it refunded

How each LemonSqueezy payment is credited

Every row is an order, a subscription invoice or a subscription status from LemonSqueezy, and the credit Virling gives it.

LemonSqueezy sendsCreditShown on
First orderGoes to a visit of the visitor ID that arrived in the webhook's custom data, by default the latest visit in the past 90 days that was not DirectChannels, Payments, New customers and Retention; Time to pay once a channel has three first payments. The subscription's initial invoice is skipped, since it is the same charge as the order
First charge after a free trialNo trial start is kept. A renewal invoice takes the channel of the customer's earliest order in Virling; without an attributed order, it needs a visitor ID from its own webhook or stays UnattributedChannels and Payments as a renewal. Not in New customers or Time to pay, and in Retention only when the customer's first payment in Virling is an order
RenewalA renewal invoice, or any later order by the same customer, keeps the first order's channelChannels and Payments as a renewal, plus net LTV on Retention
Plan changeAn updated invoice keeps the first order's channelTreated like a renewal
RefundA full or partial refund lowers its order or invoice, on that payment's date. Only the last 60 days are rescanned, every 6 hours, so a refund on an older order is missedRefunded on Channels, the refunded filter on Payments, and refund rate and net LTV on Retention
CancellationNo credit moves. Earlier payments keep their channel, and a buyer who returns under the same customer ID keeps the original oneDrops out of Still paying and MRR once cancelled passes its ends_at. Status is read hourly

Your first month of LemonSqueezy data

  1. Channels, renewals included. Revenue there includes renewal invoices, so use New customers for what the month brought, and the matched revenue line for how much has a visit behind it. Orders from before the webhook existed are Unattributed, so the start looks sparse.
  2. Retention, after a month or two. 30-day churn reads only customers whose first payment is 30 to 60 days old. A trial counts as still paying while it is on_trial, so send a trial goal from your app and watch which trials reach a charge on Payments.

Early numbers that mislead:

  • A channel showing only $0 orders. Its trials have not ended. Give it until the median on Time to pay.
  • A channel lifted by one yearly license. Count its orders on Payments before shifting effort to it.
  • Churn across a dozen customers. Retention shows no headline below 20 customers or 5 still paying, for good reason.

Before you rely on it

  • The first import covers 90 days, and only orders that came with a webhook carry a visitor ID. Subscriptions that began earlier renew mostly Unattributed until newer customers replace them.
  • Renewal invoices need no custom data of their own: the customer ID links them to the first order.
  • A payment without a customer ID cannot be linked to a first order, and one without a visitor ID still counts as revenue, under Unattributed.

Open source

Virling's source is AGPLv3 on GitHub. Pick the hosted service, or self-host one binary with nothing held back. On 2026-10-31, limited to one vCPU and 1 GB of RAM in a container, it ingested 100,000 pageviews at 2,829 a second without a single failure, at a p99 of 34 ms, and held 157 MB of memory after the run.

Questions about LemonSqueezy for SaaS

Which channel brings my LemonSqueezy subscribers?

Connect a LemonSqueezy API key and let the visitor ID ride in checkout custom data; checkout links on your store get it from the script. The first order is credited to the visits before it and every subscription invoice keeps that channel, so Channels and Retention show which sources bring buyers who keep paying.

How are LemonSqueezy renewals attributed?

Subscription invoices with billing reason renewal or updated are renewals. They copy the channel, referrer, campaign and landing page of the customer's first order, found by LemonSqueezy customer ID.

Are LemonSqueezy license keys tracked?

Virling reads the order that paid for a license key, not the key itself. The order is credited to a channel like any other, and activations or validations are not imported.

Does the LemonSqueezy API key have to be read-only?

It cannot be: LemonSqueezy keys have full access and cover every store on the account. Virling reads orders, subscription invoices and subscriptions, adds one webhook per store, and keeps the key encrypted. Delete the key in LemonSqueezy to revoke access.

Why does Virling add a webhook to my LemonSqueezy store?

The visitor ID travels in checkout custom data, which LemonSqueezy returns only in webhooks. Virling registers one for order_created and subscription_payment_success on each store and checks every delivery against its X-Signature before attaching a visitor ID.

What about LemonSqueezy subscriptions that began before Virling was connected?

The first import reads 90 days of orders and subscription invoices. If a subscription's first order is older, its earliest payment in Virling stands in; that payment rarely has a visit, so the renewals are usually Unattributed, and so is any order from before the webhook. They still count as revenue, but a customer whose earliest payment in Virling is a renewal is not in Retention.

More detail: the SaaS setup guide, the LemonSqueezy docs page and how renewals are credited.

Start free trial