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

See which channel brings your Polar subscribers.

For SaaS products and developer tools that sell subscriptions, licenses or sponsorships through Polar. Virling ties each order, the first payment 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.

Start free trial See the demo

Polar records every order, refund and subscription, but not the README link, post or search that sent the buyer. A renewal months later happens without any visit to your site. Virling connects the two using an organization access token that can only read.

What you get

  • A channel on every order. Virling joins a Polar customer's first paid order to that visitor's earlier visits. The default model picks the most recent visit within 90 days that was not Direct; switch to first touch or a 365-day window when buyers evaluate for weeks.
  • Trials counted once they pay. A $0 subscription_create order marks the start of a trial and adds nothing to revenue, payments or customers. When the first charge comes, it inherits the visits from before the trial.
  • Renewals tied to the first order. Orders billed as subscription_cycle or subscription_update are renewals. They inherit channel, referrer, campaign, landing page, country and device from the customer's first paid order, found by Polar customer ID.
  • Refunds and late payments picked up. A new refund lowers its order, and one still pending is checked again once it settles. Orders not yet paid are rechecked every 10 minutes for up to 30 days.
  • Who still pays, by channel. Retention groups customers by the channel of their first order, with still paying, net LTV and 30-day churn. The subscriptions:read scope lets Virling read status hourly, counting active, trialing and past_due as paying; without it, payment recency stands in.
  • Revenue per visitor and time to pay. Rank channels by revenue per visitor on the Channels card, and read the median days from first visit to first payment on Time to pay before you judge a slow one.

See which channel brings your Polar subscribers

For SaaS products and developer tools that sell through Polar. Virling is open source under AGPL: self-host it free, or use the hosted version with a 14-day free trial.

Start free trial See the demo

Set it up

  1. Add the site. Click + Add a site and enter your domain, such as yourproduct.com, and its timezone.
  2. Install the script. Paste the tag before </head> on your marketing site and your app. The virling_vid cookie is set on your registrable domain, so yourproduct.com and app.yourproduct.com share one visitor ID. Leave cookieless mode off.
  3. Connect Polar. In your Polar organization's settings, create an Organization Access Token with orders:read and refunds:read, plus subscriptions:read for retention. Paste it under payments; it starts with polar_oat_, and production and sandbox tokens both work. The last 90 days are imported, then new orders every minute.
  4. Pass the visitor ID at checkout. Checkout links on buy.polar.sh need no code: keep the link as a normal <a href> on a page that runs the script, and the script adds reference_id=<visitor ID>, which Polar stores in the order's metadata. For a checkout session you create on your server, set virling_vid in metadata. 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://yourproduct.com/thanks",
  metadata: { virling_vid: req.cookies.virling_vid },
});
// Send the customer to checkout.url

The full walkthrough, from tagged links to revenue per channel, is in Polar UTM tracking. Every setting is on the Polar integration page, and Virling for developer tools covers the wider setup for products sold to developers. If you sell an AI app with usage billing or credits, Polar for AI apps covers metered prices and benefits.

Checkout links, metadata and benefits

  • Checkout links. On a page that runs the script, a buy.polar.sh link gets reference_id=<visitor ID> added, and Polar keeps it in the order's metadata. A reference_id you already set on the link is left alone, so that order carries no visitor ID, and sandbox links are not touched.
  • Where Virling looks. virling_vid in the order's metadata wins, then the order's custom field data, then the customer's metadata, then the link's reference_id. Setting it on the customer covers orders you create for them later.
  • The amount. Virling records the order's net amount: after discounts, before tax. The sales tax or VAT Polar adds as merchant of record is not in your Virling revenue, and neither is the refunded tax.
  • Benefits. License keys, repository access, Discord roles and downloads are granted by Polar after the order. Virling reads the order that paid for them, not the benefits, so a tier is credited by what the customer paid.
  • The open-source maintainer case. If you sell a paid tier, support plan or sponsorship for an open-source project, many buyers come from your repository. A visit referred by github.com shows as the GitHub source in the Referral channel, next to posts and search. Point the README at a page on your own site, not straight at the checkout link: a link clicked on GitHub never passes the script, so its order is Unattributed.

Example: one Polar subscriber

This is a made-up example with invented numbers, to show how each order lands in Virling.

DayWhat Polar recordsWhat Virling shows
0Nothing yet: the visitor follows a link in your GitHub README to your docsA visit from the GitHub source, in the Referral channel
3An order of billing reason subscription_create for the $20 Pro plan, bought through the checkout link on your pricing page, with tax added on top for an EU buyerA $20 payment credited to GitHub, and one new customer. The tax is not in the $20
18The customer moves to the Team plan, and Polar bills the $25 prorated difference right away as a subscription_update orderA $25 payment marked as a renewal, credited to GitHub through the customer ID. Still one customer
20You refund the $25 upgrade order in fullThe day 18 order shows as refunded, on day 18. GitHub now has $45 of payments, $25 of them refunded

Trials, renewals, upgrades and refunds

Each row is an order, a refund or a subscription status as Polar sends it, and the way Virling credits it.

What happensHow Virling credits itWhere it shows
First paymentTo a visit of the visitor ID in the order's metadata or custom field data, or the customer's metadata, by default the latest visit in the last 90 days that was not DirectChannels, Payments, New customers and Retention, and Time to pay once the channel has three first payments
Payment after a free trialTo the visits before the trial, which starts with a $0 order of billing reason subscription_create, when the order has no visitor ID of its own. An order of billing reason subscription_cycle is marked as a renewalChannels and Payments, marked as a renewal. Not in New customers, Time to pay or the Retention customers, and the trial itself is never a payment
RenewalAn order of billing reason subscription_cycle, or any later order of the same customer, keeps the channel of the first paymentChannels and Payments, marked as a renewal, and in net LTV on Retention
UpgradeAn order of billing reason subscription_update keeps the channel of the first paymentSame as a renewal
RefundA succeeded refund lowers its order, on that order's date, even when the order is older than 90 days. A pending one counts if it succeeds within 7 daysRefunded on the Channels card, the refunded filter on Payments, and refund rate and net LTV on Retention
Cancelled customerCredits nothing. Past payments keep their channel, and a customer who returns with the same customer ID keeps the first oneLeaves Still paying on Retention, and MRR. With subscriptions:read, status is read once an hour and a cancellation at period end counts as paying until then; without it, Retention uses payment recency and there is no Polar MRR

Read your first month

  1. Start on Channels, with renewals in mind. Revenue there counts renewals, so New customers is the number for what this month won. The matched revenue line shows how much of it has a visit behind it; orders imported from before the script are Unattributed, so early months look thin.
  2. Move to Retention once you have customers. 30-day churn covers only customers whose first payment is older than 30 days and no older than 60. When Polar bills a trial's first paid order as subscription_cycle, that customer is left out of the Retention customers; read trial signups on Payments instead.

Three readings to hold off on:

  • A channel with no orders yet. Buyers still in a trial have paid nothing. Wait until Time to pay says its median has passed.
  • A channel on top because of one buyer. A yearly license or a large sponsorship can lead the table alone. Count its orders on Payments.
  • A retention verdict on a few customers. Under 20 customers, or under 5 still paying, Retention shows no headline, and that is the right call.

What to know

  • The first import covers 90 days of orders. A subscription that began earlier has its renewals mostly Unattributed until new customers replace it.
  • Renewal orders need no metadata, because the customer ID links them to the first order.
  • An order without a visitor ID still counts as revenue, under 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

Which channel brings my Polar subscribers?

Connect Polar to Virling with a read-only organization access token and pass the visitor ID in the checkout metadata; Polar checkout links 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 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.

What about free trials on Polar?

A $0 order with billing reason subscription_create starts a trial. Virling never counts it as revenue, a payment or a customer. The customer's later payment, which has no visitor ID of its own, is credited to the visits before the trial started.

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, and Virling never creates, changes or refunds anything.

What about Polar subscriptions that began before Virling was connected?

Virling imports orders from the last 90 days. When a subscription's first order is older than that, its earliest order in Virling stands in, and it rarely has a visit, so its renewals are usually Unattributed. A first order inside the 90 days but from before the script was on your site is Unattributed too. All of them count toward revenue, but a customer whose earliest payment in Virling is a renewal is left out of Retention.

Full guides: Set up Virling for a SaaS product, Polar in the docs and Renewals.

Start free trial