LemonSqueezy plugin sales attribution: which channel sells your plugin or theme.
For plugin and theme makers who sell licenses through LemonSqueezy. Virling ties each license sale and renewal to the post, directory listing or search that brought the buyer, so you see which of them brought the money, not just the downloads. It works when the buyer visits your site and checkout carries the visitor ID. Open source under AGPL, hosted or self-hosted.
LemonSqueezy records who bought a license and how much they paid, but not the visit that brought them. A plugin buyer may install the free version, read the docs and come back weeks later to pay, and the renewal a year on never touches your site. Virling joins the sale to the visits before it through the visitor ID in checkout, and gives the renewal the same credit.
What you get
- Each license sale credited to a visit. 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. Switch the site to first touch to credit the visit that introduced the buyer.
- Renewals that keep the first channel. A subscription invoice with billing reason
renewalis a renewal. It copies the channel, referrer, campaign, landing page, country and device of the customer's first payment, matched by LemonSqueezy customer ID. Plan changes (billing reasonupdated) keep that channel too. - Listings, posts and search side by side. A click from wordpress.org is Referral under its own domain, a click from Reddit or Hacker News is Communities, and a click from a known search engine is Organic search. A search click names the search engine, not the words typed.
- Revenue per source, campaign and landing page. The dashboard lists visitors, revenue and revenue per visitor for each, so a listing that sends many visitors and no sales stands apart from a docs page that sells.
- Refunds taken off. Refunds do not change an order's creation time, so Virling rescans the last 60 days for refunds every 6 hours.
Set it up
- Add the site and the script. Click + Add a site, enter your domain and timezone, and paste the tag before
</head>on every page, including docs on a subdomain. Leave cookieless mode off, since checkout needs the visitor ID. Docs revenue tracking shows how to read which docs pages sell. - Tag the links in listings, readmes and the plugin. Give each placement
utm_sourceand its ownutm_campaign, and point it at a page on your site, not at checkout. App marketplace revenue tracking shows how to tag a directory listing, and attribution for plugins and themes covers where each kind of link lands. - 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 reads orders, subscriptions with their prices and store currency, and subscription invoices, adds one webhook to each store, and stores the key encrypted. The last 90 days are imported, then new orders and invoices every minute.
- Link checkout to visits. LemonSqueezy returns custom data only in webhooks, so Virling registers one for
order_createdandsubscription_payment_successwhen you connect, and checks each one against itsX-Signature. Checkout links onSTORE.lemonsqueezy.comneed no code: the script addscheckout[custom][virling_vid]to them. LemonSqueezy UTM tracking has the full steps. 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. To see what you keep from each license after fees, use the LemonSqueezy fee calculator. Every setting is on the LemonSqueezy integration page.
What cannot be attributed
- A sale whose checkout carried no visitor ID is Unattributed. That includes a checkout link opened straight from the plugin, a readme or an email, and a purchase from your LemonSqueezy store without a visit to your site. It still counts toward revenue.
- Renewals of a subscription that started before the 90-day import, and renewals of a first payment that was Unattributed, are usually Unattributed too. Payments without a customer ID cannot be linked to a first payment.
- Renewals follow the customer's first payment, not the first payment of each license. If a customer buys a second plugin on subscription, its renewals get the channel of their first purchase.
- Customers are matched per provider. A customer who moves from LemonSqueezy to another provider counts as two customers, and the renewals there do not inherit the LemonSqueezy credit.
- Sales a marketplace bills itself do not pass through your LemonSqueezy checkout, so they are not in Virling.
- The script adds the visitor ID only to normal
<a href>links on*.lemonsqueezy.com. If your store uses a custom domain, pass the ID yourself as in the snippet above. - 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.
Frequently asked questions
Which channel sells my plugin?
Add the Virling script to your site, connect LemonSqueezy and let checkout carry the visitor ID. Each license sale is then credited to a visit before it, and the dashboard shows revenue per channel, source, campaign and landing page. Sales whose checkout carried no visitor ID show as Unattributed.
Are LemonSqueezy license renewals credited to the channel that sold the first license?
Yes, when the license is billed as a LemonSqueezy subscription and the customer's first payment is in Virling and attributed. A subscription invoice with billing reason renewal copies the channel, referrer, campaign, landing page, country and device of that first payment. A license bought again as a one-time order is a new sale, credited from its own visitor ID.
Can I see which plugin directory listing brought a sale?
Yes, when the buyer clicks from the listing to your site and checks out from there. A click from wordpress.org shows as Referral under wordpress.org. Put utm_source and utm_campaign on the listing's link, or use a tracked link, to give it its own row in the Campaign tab.
Does an upgrade link inside the plugin get tracked?
If it opens a page on your site, yes: tag it with utm_source and its own utm_campaign, because links from an admin screen often arrive with no referrer. If it opens the LemonSqueezy checkout directly, it carries no visitor ID and the sale is Unattributed.
Are sales from before I installed Virling attributed?
No. Orders and subscription invoices from the last 90 days are imported and count toward revenue, but their buyers were not tracked, so they are Unattributed. Subscriptions that started before that import have no first payment in Virling, so their renewals are Unattributed too.
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 with their prices and store currency, 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.
Full guides: LemonSqueezy in the docs, Renewals and Tracked links.