Connect Polar

Connecting Polar turns on every revenue feature for a site: the metrics, the conversions list, and the link between an order and the visit that drove it. You connect Polar per site, so each site reports its own revenue.

It takes a minute: create an organization access token in Polar, paste it into the site's integration settings, and Snow handles the rest.

Polar's sandbox and production are entirely separate environments, and a token works against only one of them. Paste either - Snow works out which one it was given and syncs that environment.

Create an organization access token

In the Polar dashboard, open Settings → Developers for the organization whose revenue you want in Snow, and click New Token. Name it SnowAnalytics and grant these scopes:

  • orders:read
  • subscriptions:read
  • refunds:read
  • customers:read
  • products:read
  • webhooks:read and webhooks:write

The write scope is only used to create one webhook endpoint of Snow's own, so payments show up the moment they happen. Without it Snow still works, just on polling alone.

Polar tokens look like this:

polar_oat_...

The token is shown once, so copy it before you close the dialog.

Paste it into your site's integration settings

Back in Snow, go to Settings → Integrations → Revenue Analytics → Polar and paste the token. Snow encrypts the token at rest before storing it, so the raw token is never kept in plain text.

Snow imports your revenue

As soon as the token is saved, Snow connects to Polar and imports your orders and subscriptions. Your revenue metrics and conversions list start filling in. From here on, Snow keeps everything current automatically. See how revenue stays up to date.

Tie an order back to a visit

An order shows up in Snow on its own. To link it to the visitor and source that drove it, pass the two ids the Snow tracking snippet sets on the page - they live in the _sa_vid and _sa_sid cookies. Polar gives you two places to put them, depending on how you sell.

If you create checkout sessions through the API

Set them as metadata on the checkout session. Polar copies that metadata onto the resulting order, which is where Snow reads it:

await polar.checkouts.create({
  products: [productId],
  metadata: {
    sa_visitor_id: visitorId,
    sa_session_id: sessionId,
  },
});

This is the same convention Snow uses for Stripe and Dodo Payments.

A Checkout Link can't carry arbitrary metadata, so both ids go into its one free-form field, joined by a dot:

https://buy.polar.sh/polar_cl_...?reference_id=<visitorId>.<sessionId>

Snow splits on the first dot. A reference_id with no dot is treated as a visitor id on its own, which still attributes - Snow recovers the session from that visitor's most recent page view.

Which orders count

Snow records an order once it is paid, and uses its gross total (tax included), so the figure matches what Stripe and Dodo report. Orders still in draft or pending are ignored until they're paid, and Polar's own billing_reason is what tells Snow whether a charge was a first subscription, a renewal, a plan change, or a one-off purchase.

Refund an order in Polar and Snow mirrors it: the completed conversion is replaced by a refunded one, keeping the visit it was attributed to.

Next step

On this page