Skip to content

Lantern Analytics for Polar

Polar analytics: revenue by channel for your Polar products

Connect Polar to Lantern with a read-only organization token and see which channels and AI assistants bring the customers behind your orders and subscriptions.

What Polar can't tell you

Polar sells your software and handles tax. Lantern shows where each buyer came from, so you know which posts, searches and assistants are worth your time.

Lantern is web analytics for founders. Its script records where every visitor comes from: Google, Reddit, a campaign, or an AI assistant like ChatGPT. Connect Polar and each payment is credited to the channel, referrer, campaign, country and landing page that first brought that customer, even when they paid days or weeks later.

Lantern's Sources card with a revenue column next to visitors for each channel: Organic Search, Direct, Social, AI, Referral, Email and Paid
Revenue by channel on Lantern's dashboard, next to the visitors each channel sent.

How Lantern connects to Polar

  • API key: An organization access token with only the orders:read scope. Lantern imports your recent orders.
  • Webhook: Optional: add Lantern's URL under Settings → Webhooks (format Raw) and paste the secret.
  • History on connect: Your recent orders, back to 90 days.

Webhook events to subscribe to: order.paid, order.refunded. Everything is set up from your site's Settings → Revenue panel, which shows the webhook URL and the exact steps.

Set it up

  1. Start a free trial and add your website. Paste the setup prompt into your coding agent, or add one script tag.
  2. Pass the visitor id to Polar: put lantern_visitor_id in metadata on the checkout. If the customer is signed in, add lantern_user_id with the id you pass to identify.
  3. Open Settings → Revenue → Polar in Lantern and connect it.
Polar SDK, creating a checkout
const checkout = await polar.checkouts.create({
  products: ["prod_123"],
  metadata: {
    lantern_visitor_id: visitorId, // window.lantern?.visitorId?.(), sent from the browser
    lantern_user_id: user.id,
  },
});

Renewals and refunds don't need tagging. They share the customer and subscription of the first payment, so Lantern credits them to the same channel.

Good to know

  • Orders cover one-time purchases and every subscription cycle.
  • Refunds on older orders arrive through the webhook; the key sync looks at recent orders.

Questions

Which Polar scope does Lantern need?

Only orders:read. Lantern never creates, changes or refunds anything.

Other payment providers

Lantern also connects to Razorpay, Cashfree, Stripe, Dodo Payments, Paddle and Lemon Squeezy. Connect more than one to the same site and Lantern adds them up.