Skip to content

Lantern Analytics for Lemon Squeezy

Lemon Squeezy analytics: which channel brings your buyers

Connect Lemon Squeezy to Lantern with a webhook and see orders, renewals and refunds by channel, referrer, campaign and country.

What Lemon Squeezy can't tell you

Lemon Squeezy shows your sales. Lantern shows which marketing produced them, from the first visit to the order.

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 Lemon Squeezy 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 Lemon Squeezy

  • API key: Optional. Lemon Squeezy keys can't be limited, so Lantern only ever reads with one, and only to import history.
  • Webhook: The default. Lantern generates the signing secret; paste it and the URL under Settings → Webhooks.
  • History on connect: The last 90 days if you add a key; from the moment you connect otherwise.

Webhook events to subscribe to: order_created, order_refunded, subscription_payment_success, subscription_payment_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 Lemon Squeezy: put lantern_visitor_id in checkout[custom] in the checkout URL, or checkout_data.custom in the API. If the customer is signed in, add lantern_user_id with the id you pass to identify.
  3. Open Settings → Revenue → Lemon Squeezy in Lantern and connect it.
Linking to a Lemon Squeezy checkout from the browser
const url = new URL("https://yourstore.lemonsqueezy.com/buy/variant-id");
url.searchParams.set("checkout[custom][lantern_visitor_id]", window.lantern?.visitorId?.() ?? "");
window.location.href = url.toString();

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

  • Custom data arrives on webhooks only, so history imported with a key is matched by customer and email instead.
  • Renewals are subscription payments with the same customer, credited to the first order's channel.

Questions

Do I need a Lemon Squeezy API key?

No. The webhook is enough. A key only adds payments from before you connected.

Other payment providers

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