How-to

# How to Track Polar Revenue by Traffic Source

Connect Polar.sh orders to the visits, sources and UTM campaigns behind them: checkout links with no code, the Checkout API, webhooks, renewals and refunds.

Last reviewed 22 November 2026 · 10 min read · By the [SuprAnalytics team](https://supranalytics.app/about) at SuprApps

Polar shows you every order. It doesn't show you which post, search or newsletter sent the customer. To see that, a visitor id from your website analytics has to ride along with the checkout and come back with the order.

With Polar this is shorter than with most payment providers, because checkout links can carry the id without any code. This guide covers both ways to pay with Polar, the webhook that reports each order, and where attribution can't find a source.

## The quick answer

To attribute Polar revenue to traffic sources:

1. Record each visit and its source with an analytics script on every page.
2. Carry the visitor id into checkout. Polar checkout links get it automatically; Checkout API sessions take it as metadata.
3. Add a Polar webhook for `order.paid`, `order.updated` and `order.refunded`.
4. Each paid order is matched to the visitor, and your attribution model picks which of their visits gets the credit.

## Why Polar alone can't tell you where customers came from

Polar knows the order: the product, the amounts, the customer and their email, and the subscription it belongs to. It also keeps metadata. A checkout link even accepts `utm_source`, `utm_medium` and `utm_campaign` in its URL and attaches them to the checkout session ([Polar: checkout links (Polar documentation, opens in a new tab)](https://polar.sh/docs/features/checkout/links)).

Those tags describe the link that was clicked, not the visit before it. If a customer read your post on Reddit, came back two days later through Google and clicked the same buy button, the tags on that button are the same either way. The referrer, the landing page and the earlier visits live in your website analytics, which has never seen the order. Joining the two needs an id both sides share.

## Step 1: Track website visitors and their sources

Add the SuprAnalytics script to the `<head>` of every page ([installation guides](https://supranalytics.app/docs/installation.md)). Each visit then records its referrer, its UTM tags, its landing page and a visitor id kept in a first-party cookie for a year. A visit with no referrer and no tags counts as Direct. The [tracking parameters guide](https://supranalytics.app/docs/tracking-parameters.md) lists the tags it reads, and the [Stripe guide](https://supranalytics.app/blog/how-to-track-stripe-revenue-by-traffic-source) explains sources and sessions in more depth; it all applies to Polar too.

## Step 2: Carry the visitor into Polar checkout

### Checkout links: nothing to add

When a visitor clicks a Polar checkout link (`https://buy.polar.sh/polar_cl_…`), the SuprAnalytics script adds `?reference_id=` and their visitor id to the link before the browser follows it. Polar stores it with the checkout, the order comes back through the webhook, and the id names the visitor.

From the SuprAnalytics Polar checkout links guide

```
<a href="https://buy.polar.sh/polar_cl_XXXXXXXX">Buy now</a>
<!-- clicked: https://buy.polar.sh/polar_cl_XXXXXXXX?reference_id=6f1c… -->
```

- A link that already has a `reference_id` is left alone, so your own ids keep working.
- A `reference_id` only counts as a visitor if SuprAnalytics has seen that visitor, so your own reference ids are never mistaken for one.
- To stop the script changing a link, add `supr-polar="false"` to it.

### Checkout API: pass the id as metadata

If your server creates the checkout, read the `supr_visitor_id` cookie from the request and put it in the checkout's metadata. The webhook returns the order with that metadata.

Node.js, from the SuprAnalytics Polar Checkout API guide

```
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({ accessToken: process.env.POLAR_ACCESS_TOKEN });
app.post("/checkout", async (req, res) => {
  const checkout = await polar.checkouts.create({
    products: ["<product id>"],
    successUrl: "https://yourdomain.com/thanks",
    metadata: {
      supr_visitor_id: req.cookies.supr_visitor_id,
      supr_session_id: req.cookies.supr_session_id,
    },
  });
  res.redirect(303, checkout.url);
});
```

Runs on your server; the access token never goes in browser code. `req.cookies` is Express with cookie-parser. Next.js and Python versions are in the [Checkout API guide](https://supranalytics.app/docs/polar-checkout-api.md).

### When there's no id: customer id and email

An order without a visitor id still counts. SuprAnalytics then looks for the Polar customer id on an earlier order that was matched, then a visitor with the same email, known from an earlier payment or from the [identify call](https://supranalytics.app/docs/user-identification.md) your app makes at sign-up. If nothing matches, the order is revenue without a source.

What breaks the connection

- **Another device or browser.** A phone and a laptop are two visitors.
- **Blocked tracking.** Ad blockers can stop visits being recorded. [Serving the script from your own domain](https://supranalytics.app/docs/proxy-guide.md) helps.
- **Cookieless mode.** A visitor is recognised for one day (UTC), so only same-day orders are attributed ([cookieless tracking](https://supranalytics.app/docs/cookieless-tracking.md)).
- **A link opened elsewhere.** A checkout link sent by email and opened without a visit to your site has no visitor id to add.

## Step 3: Connect the Polar webhook

The connection is one webhook endpoint per website and its secret. There's no API key to share, and past orders aren't imported: SuprAnalytics records orders from the moment the webhook is set up.

1. Copy your webhook URL

   In SuprAnalytics, open the website's **Settings → Revenue**, where Polar is the default provider, and copy the URL. It looks like `https://supranalytics.app/api/webhooks/polar/YOUR_WEBSITE_ID`.
2. Add an endpoint in Polar

   In Polar, open **Settings → Webhooks** and click **Add Endpoint**. Paste the URL and choose the **Raw** format, which sends JSON ([Polar: webhook endpoints (Polar documentation, opens in a new tab)](https://polar.sh/docs/integrate/webhooks/endpoints)).
3. Select three events

   Select `order.paid`, `order.updated` and `order.refunded`.
4. Paste the secret

   Copy the endpoint's secret, which starts with `whsec_`, into Settings → Revenue with Polar selected, and save.

| Polar event | What SuprAnalytics does |
| --- | --- |
| `order.paid` | What SuprAnalytics does: Records the order once Polar has collected the money ([Polar: orders (Polar documentation, opens in a new tab)](https://polar.sh/docs/features/orders)). Orders not paid yet are skipped, and so are free ones. |
| `order.updated` | What SuprAnalytics does: Updates the stored order when it changes, such as a renewal order moving to paid. |
| `order.refunded` | What SuprAnalytics does: Marks the order refunded, or lowers its amount for a partial refund. |

### What happens on every delivery

- **Signature check.** Polar signs each delivery with the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers. SuprAnalytics checks the signature against your secret and refuses a timestamp more than 5 minutes off. A wrong secret is answered with 403 "Invalid signature" and nothing is recorded. Both Polar secret formats work: the Standard Webhooks one for secrets created since 8 September 2026, and the older one ([Polar: webhook delivery (Polar documentation, opens in a new tab)](https://polar.sh/docs/integrate/webhooks/delivery)).
- **Retries.** Polar retries a failed delivery up to 10 times with exponential backoff, and disables an endpoint after 10 failures in a row.
- **Duplicates.** Each order is stored once, so a delivery that arrives twice doesn't count twice.

## Step 4: Test in Polar's sandbox

Polar has a separate [sandbox (Polar documentation, opens in a new tab)](https://polar.sh/docs/integrate/sandbox) at sandbox.polar.sh, with its own products, tokens and webhooks. Test there; never make a real purchase just to test attribution.

Use a separate website for testing

Each website keeps one Polar secret, and payments can't be deleted, so test orders sent to your real website stay in its revenue. Add a second website for your staging site, with its own script and webhook URL, and point the sandbox webhook at it.

1. In the sandbox, add an endpoint for the test website's URL with the three events, and paste its secret into that website's Settings → Revenue.
2. Open your staging site in a fresh window with a tagged link, such as `?utm_source=test&utm_medium=email&utm_campaign=attribution_check`.
3. Click your checkout link (or start your API checkout) and pay with Polar's test card, 4242 4242 4242 4242 with any future date.
4. In Polar, open the endpoint's deliveries. The order's delivery should show status 200; where the response is shown, look for `"attributed": true`.
5. In SuprAnalytics, the payment appears in the visitor's journey and the Campaign report credits `attribution_check`.

The response SuprAnalytics sends Polar for a recorded, matched order

```
{
  "received": true,
  "result": { "visitorId": "…", "attributed": true, "duplicate": false }
}
```

`"attributed": false` means the order was recorded without a source: check that the checkout carried the visitor id. A retried delivery answers `"duplicate": true`.

When it works, add a second endpoint in your live Polar organization for your real website, with its own secret.

Revenue by referrer on the demo website, with payments from several providers combined.

## What Polar revenue SuprAnalytics counts

| Order | How it's counted |
| --- | --- |
| Amount | How it's counted: The order's `net_amount`: after discounts, before tax. Polar is the merchant of record and handles sales tax ([Polar: merchant of record (Polar documentation, opens in a new tab)](https://polar.sh/docs/merchant-of-record/introduction)), so tax isn't your revenue. Orders in other currencies are converted to your website's currency with daily rates. |
| First order | How it's counted: Counts toward new customers, conversion rate and revenue. |
| Renewal | How it's counted: An order with the billing reason `subscription_cycle`, `subscription_update` or `subscription_meter_cycle`. Revenue, but not a new customer. Credited to the same visitor through the subscription's or customer's metadata, or the Polar customer id of an earlier matched order. |
| Free order | How it's counted: Skipped: there's no revenue to attribute. |
| Full refund | How it's counted: Marks the payment refunded; it drops out of revenue. |
| Partial refund | How it's counted: Lowers the payment by the refunded amount before tax. Polar supports partial refunds from the dashboard and its API ([Polar: refunds (Polar documentation, opens in a new tab)](https://polar.sh/docs/features/refunds)). |

So SuprAnalytics totals won't match Polar figures that include tax. Payment tracking also isn't subscription analytics: SuprAnalytics doesn't calculate MRR, ARR or churn. What it adds is where paying and renewing customers came from ([subscription revenue](https://supranalytics.app/features/subscription-revenue)).

## First touch or last touch?

Each order keeps two visits: the visitor's first visit ever and their last visit before paying. **Last touch** is the default and credits the visit that converted, even a direct one. **First touch** credits the visit that brought them in. Change it in **Settings → Revenue → Attribution model**; the switch re-credits past orders too. The [first-touch vs last-touch guide](https://supranalytics.app/blog/first-touch-vs-last-touch-attribution) works through examples.

## Common Polar attribution problems

| Problem | Likely cause and fix |
| --- | --- |
| No Polar orders show up | Likely cause and fix: Open the endpoint's deliveries in Polar. 400 "Polar is not configured for this website" means no secret is saved for that website; 403 "Invalid signature" means the secret belongs to another endpoint, or sandbox and live are mixed up. |
| Orders have no source | Likely cause and fix: The checkout carried no visitor id. Check that the script runs on the page with the checkout link, or that your server passes the metadata, and identify signed-in users before checkout. |
| A checkout link isn't tagged | Likely cause and fix: It already has a `reference_id`, carries `supr-polar="false"`, or the click happened before the script loaded. The link must be on buy.polar.sh, or on another polar.sh address with `polar_cl_` in it. |
| Too much Direct revenue | Likely cause and fix: Untagged links, apps that drop the referrer, or last touch crediting direct returns. Tag the links you share, or compare with first touch. |
| Revenue lower than in Polar | Likely cause and fix: SuprAnalytics counts the amount before tax, lowers partial refunds and skips free orders. |

More on this: [Polar revenue attribution](https://supranalytics.app/integrations/polar) · [Polar setup guide](https://supranalytics.app/docs/polar.md) · [Checkout links](https://supranalytics.app/docs/polar-checkout-links.md) · [How revenue attribution works](https://supranalytics.app/revenue-attribution) · [Pricing](https://supranalytics.app/pricing)

## Frequently asked questions

### Can Polar show where my customers came from?

Not on its own. Polar records the order, the customer and their email, and any metadata, including a reference_id or UTM tags added to a checkout link. It doesn't see the visits before checkout, so it can't tell you that a customer first found you through a search last week.

### Do Polar checkout links need any code for attribution?

No. With the SuprAnalytics script on the page, a click on a buy.polar.sh checkout link adds the visitor's id as reference_id. Polar keeps it with the order and the webhook brings it back. Checkouts your server creates through the Checkout API need the visitor id passed as metadata.

### Which Polar webhook events do I need?

order.paid, order.updated and order.refunded, sent in the Raw format to your website's webhook URL. SuprAnalytics records an order once it's paid and applies refunds when they arrive.

### Does SuprAnalytics count tax in Polar revenue?

No. Revenue is the order's net_amount: after discounts, before tax. Polar is the merchant of record and handles sales tax, so the tax isn't your revenue. Totals can differ from Polar figures that include tax.

### Are Polar subscription renewals tracked?

Yes. Orders with the billing reasons subscription_cycle, subscription_update and subscription_meter_cycle are recorded as renewals, credited to the same visitor through the subscription's or customer's metadata or the Polar customer id of an earlier matched order. Renewals don't count as new customers. This is payment tracking, not MRR or churn.

### How are Polar refunds handled?

A full refund marks the payment refunded and it drops out of revenue. A partial refund lowers the payment by the refunded amount before tax.

### Can I import past Polar orders?

No. SuprAnalytics records orders from the moment the webhook is set up. Earlier orders stay in Polar.

### Why do some Polar orders have no traffic source?

They couldn't be matched to a recorded visit: the checkout carried no visitor id, the customer paid from a link opened outside your site, an ad blocker hid the visits, or cookieless mode saw a later day as a new visitor. They still count in your total revenue, without a source.

## More articles

[All articles](https://supranalytics.app/blog)

- [Guide · 22 min readBest Analytics Tools for SaaS in 2026Compare the best SaaS analytics tools for website traffic, product usage, conversions, subscriptions, and revenue attribution. Find the right fit for your SaaS.Read](https://supranalytics.app/blog/best-analytics-for-saas)
- [Comparison · 18 min readBest Google Analytics Alternatives With Revenue Tracking in 2026Compare Google Analytics alternatives for revenue tracking, Stripe payments, conversions, and attribution. Find the right analytics tool for your business.Read](https://supranalytics.app/blog/google-analytics-alternatives-with-revenue-tracking)
- [Comparison · 4 min readBest Privacy-Friendly Website Analytics Tools in 2026Compare privacy-friendly website analytics tools by cookies, visitor tracking, hosting, features, and pricing. Find the right alternative to Google Analytics.Read](https://supranalytics.app/blog/best-privacy-friendly-analytics)
- [How-to · 17 min readHow to Track Stripe Revenue by Traffic SourceLearn how to connect Stripe payments to website traffic sources, UTM campaigns, and visitor journeys. Understand attribution, webhooks, renewals, and refunds.Read](https://supranalytics.app/blog/how-to-track-stripe-revenue-by-traffic-source)
- [How-to · 11 min readHow to Track Paddle Revenue by Traffic SourceConnect Paddle Billing payments to the traffic sources, UTM campaigns and visits behind them: checkout buttons, Paddle.js, webhooks, renewals and refunds.Read](https://supranalytics.app/blog/how-to-track-paddle-revenue-by-traffic-source)
- [How-to · 11 min readHow to Track Dodo Payments Revenue by Traffic SourceConnect Dodo Payments to the traffic sources, UTM campaigns and visits behind each payment: payment links, checkout sessions, webhooks, renewals and refunds.Read](https://supranalytics.app/blog/how-to-track-dodo-payments-revenue-by-traffic-source)
- [How-to · 13 min readHow to Track Lemon Squeezy Revenue by Traffic Source (and Keep It When You Migrate)Credit Lemon Squeezy orders to traffic sources until it stops taking payments on 31 March 2027, and keep that history when you move to another provider.Read](https://supranalytics.app/blog/how-to-track-lemon-squeezy-revenue-by-traffic-source)
- [How-to · 13 min readHow to Track ChatGPT Referral TrafficLearn how to identify ChatGPT referral traffic, track AI visitors and conversions, and understand why some AI-driven visits appear as Direct.Read](https://supranalytics.app/blog/how-to-track-chatgpt-referral-traffic)
- [How-to · 15 min readHow to Track Conversions Without Google Analytics 4Learn how to track website conversions without GA4, including button clicks, form submissions, signups, purchases, and conversion funnels.Read](https://supranalytics.app/blog/how-to-track-conversions-without-ga4)
- [Explainer · 13 min readFirst-Touch vs Last-Touch Attribution: What's the Difference?Understand first-touch vs last-touch attribution with real-world examples. Learn how each model credits traffic sources, conversions, and revenue.Read](https://supranalytics.app/blog/first-touch-vs-last-touch-attribution)

---

This page on the web: https://supranalytics.app/blog/how-to-track-polar-revenue-by-traffic-source
More of SuprAnalytics for AI agents: https://supranalytics.app/llms.txt
