See which channel brings the developers who pay you on Polar.
For open source maintainers and developer tool makers who sell licenses, sponsorships or subscriptions through Polar. Virling ties each Polar payment to the channel and campaign that brought the buyer, whether that was your README, a launch post, a search result or a newsletter. Open source under AGPL, hosted or self-hosted.
Polar records who paid and how much. It does not record the visit that brought the buyer to your site. Virling reads your Polar orders with a read-only organization access token and joins each one to the visitor who checked out.
What you get
- Each payment credited to a channel and campaign. When checkout carries the visitor ID, the order is joined to the visits before it, so you see whether a buyer came from GitHub, a search result, a post or a tagged campaign.
- Checkout links that need no code. Links on
buy.polar.shcarry the visitor ID by themselves: the script addsreference_idto every such link on the page, and again on click. - Renewals that keep the first channel. An order with billing reason
subscription_cycleis a renewal and takes the channel, referrer, campaign and landing page of the customer's first payment, matched by Polar customer ID. Plan changes (subscription_update) keep it too. - Trials kept apart from revenue. A $0 order with billing reason
subscription_createstarts a trial. It is never counted as revenue, a payment or a customer; the customer's later payment is credited from the visits before the trial started. - Refunds taken off. New refunds update the order they belong to, and a pending refund is read again once it settles. Unpaid orders are checked again every 10 minutes for up to 30 days and imported once paid.
- Who still pays. With
subscriptions:read, subscription status is read once an hour so Retention can tell who still pays; without it, retention falls back to payment recency.
Where developers come from
| Where the link is | Referrer that arrives | When to add a tag | Channel |
|---|---|---|---|
| Repository README | The origin github., the same for the README, an issue or a release | Always: utm_ with one utm_ per placement, such as readme or releases | Referral. With no referrer and no tag, Direct |
| Package registry | npmjs., pypi. or crates.. An install opens no page, so it is not a visit | Always, in the README and homepage field. Tag links your CLI prints too, since a click from a terminal has no referrer | Referral, each registry under its own domain. With no referrer and no tag, Direct |
| Docs | Docs on your domain or a subdomain: ignored, as your own site. Docs on another host: that host | Not between your own pages, where new tags start a new visit. Only for docs on a host you do not own | On your domain, the channel that brought the reader, with the docs page as landing page. On another host, Referral |
| Community posts | news., reddit., lobste. or dev.. Clicks from apps often send none | One utm_ per post. utm_, reddit, lobsters or devto covers clicks with no referrer | Communities. With no referrer and no tag, Direct |
When a referrer is present it decides the channel, unless utm_medium is an email or paid value, so leave those out of README and community links. Every rule and known host is in Channels.
Set it up
- Add the site. Click + Add a site and enter your project's domain, such as
yourproject.dev. - Install the script. Paste the tag before
</head>on the pages where people buy, including the page that holds your checkout links. - Connect Polar. In your Polar organization's settings, create an Organization Access Token with
orders:readandrefunds:read, plussubscriptions:readfor retention, and paste it into Virling. It starts withpolar_oat_; production and sandbox tokens both work. Orders from the last 90 days are imported on the first run, then new orders every minute. - Link checkout to visits. Keep each
buy.polar.shcheckout link as a normal<a href>on a page that runs the script, and the script addsreference_id=<visitor ID>, which Polar stores in the order's metadata. For a checkout session you create on your server, setvirling_vidinmetadatafrom thevirling_vidcookie. Virling reads it from the order's metadata, then the order's custom field data, then the customer's metadata.
const checkout = await polar.checkouts.create({
products: ["PRODUCT_ID"],
success_url: "https://yourproject.dev/thanks",
metadata: { virling_vid: req.cookies.virling_vid },
});
// Send the customer to checkout.urlPayments without a visitor ID still count toward revenue, as Unattributed.
Every setting is on the Polar integration page, and Virling for developer tools covers the wider setup. The full walkthrough, from tagged links to revenue per channel, is in Polar UTM tracking, and GitHub revenue tracking shows how to tag README, repository and release links. If your tool is an open source project, Polar for open source projects has a tagging plan per placement.
Your first week
- Day one: connect the sandbox. With the script on your site, docs and pricing page, paste a token from the Polar sandbox. Virling reads sandbox orders like real ones, and they stay in your reports after you replace the token. To keep test data out, connect the production token now and test with a small live payment that you refund.
- Day one: place a test order. In a private window, open a page that runs the script through
https://yourproject.dev/?utm_source=test&utm_medium=email, then pay with a test card in a sandbox checkout your server creates withvirling_vidinmetadata. Sandbox links do not get the visitor ID from the script; livebuy.polar.shlinks do. Pay for a plan without a trial, since a trial start is not a payment. - A minute later: read the payment. At
/app/yourproject.dev/paymentsit shows thetestsource and the Email channel instead of Unattributed. Use a new email address for the next test: a later payment by the same customer is a renewal and keeps the first channel. Then replace a sandbox token with the production one. - Rest of the week: tag the links in the table above, starting with the README and the links your CLI prints.
- After the first few sales: open Payments first. The top of the page splits revenue into new customers and renewals. Open a new payment to see the buyer's visits with the credited one marked. Then open the Channels card and its Source and Campaign tabs. Leave Retention for later: 30-day churn reads customers whose first payment was more than 30 and at most 60 days ago.
A channel example
These numbers are made up, to show how to read the report. They are not from a real product and not a benchmark. A tool with one $30 monthly plan, over 30 days, with the payments counted on the Payments page:
| Channel | Visitors | First payments | Renewals | Revenue | Revenue per visitor |
|---|---|---|---|---|---|
| Organic search | 1,000 | 5 | 20 | $750 | $0.75 |
| Referral | 1,500 | 6 | 14 | $600 | $0.40 |
| Communities | 3,500 | 5 | 3 | $240 | $0.07 |
| Direct | 800 | 2 | 6 | $240 | $0.30 |
| AI | 200 | 2 | 2 | $120 | $0.60 |
| Unattributed | - | 0 | 5 | $150 | - |
| Total | 7,000 | 20 | 50 | $2,100 | $0.30 |
Each visitor is counted under one channel here and nothing is refunded, so the rows add up. Communities won as many new customers as Organic search, and its low revenue is mostly missing renewals, which a launch post from this month cannot have yet. The five Unattributed renewals belong to subscriptions that started before the 90-day backfill. With two first payments, AI says nothing yet. Compare first payments for this month's work and revenue for what past work still earns.
What to know
- Orders older than the 90-day backfill are not imported, so renewals of subscriptions that started before that are Unattributed.
- The script adds the visitor ID only to normal
<a href>links on pages that run it, never replaces a parameter already on the link, and adds nothing in cookieless mode. - Payments without a customer ID cannot be linked to a first payment.
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 which channel brings my Polar buyers?
Connect Polar to Virling with a read-only organization access token and pass the visitor ID at checkout. Checkout links on buy.polar.sh get it from the script automatically; for a checkout session you create on your server, set virling_vid in its metadata. Each payment is then credited to the visits before it, with its channel and campaign.
Do I need to change my Polar checkout links?
No. Keep each buy.polar.sh link as a normal link on a page that runs the Virling script. The script adds reference_id with the visitor ID, unless it is already there, and Polar stores it in the order's metadata, where Virling reads it.
How are Polar renewals attributed?
An order with billing reason subscription_cycle is a renewal. It takes the channel, referrer, campaign and landing page of the customer's first payment, matched by Polar customer ID. Plan changes (subscription_update) keep that channel too.
Which scopes does the Polar token need?
orders:read and refunds:read, plus subscriptions:read so Retention can tell who still pays. No other scopes are needed.
Full guides: Polar in the docs, Link checkout to visits and Renewals.