Skip to content

Lantern Analytics for Dodo Payments

Dodo Payments analytics: revenue by channel and campaign

Connect Dodo Payments to Lantern with a read-only API key and see which channels, campaigns and AI assistants bring your paying customers, renewals and refunds included.

What Dodo Payments can't tell you

Dodo handles payments, tax and compliance as your merchant of record. Lantern shows which marketing actually produced those payments.

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 Dodo Payments 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 Dodo Payments

  • API key: A read-only API key: create one under Developer → API Keys and leave Enable write access unchecked. Lantern finds out whether it's live or test on its own.
  • Webhook: Optional: add Lantern's URL under Developer → Webhooks and paste the signing secret.
  • History on connect: The last 90 days.

Webhook events to subscribe to: payment.succeeded, refund.succeeded. 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 Dodo Payments: put lantern_visitor_id in metadata on the checkout session or payment. If the customer is signed in, add lantern_user_id with the id you pass to identify.
  3. Open Settings → Revenue → Dodo Payments in Lantern and connect it.
Node.js, creating a Dodo checkout session
const session = await dodo.checkoutSessions.create({
  product_cart: [{ product_id: "pdt_123", quantity: 1 }],
  customer: { email: user.email },
  metadata: {
    lantern_visitor_id: visitorId, // window.lantern?.visitorId?.(), sent from the browser
    lantern_user_id: user.id,
  },
  return_url: "https://example.com/welcome",
});

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

  • Each subscription renewal is its own payment and keeps the channel of the first one.
  • $0 trial and mandate charges aren't counted as revenue, but still link the customer to their visit.

Questions

Is a read-only Dodo key enough?

Yes. Lantern only reads payments and refunds, so a key without write access is all it needs.

Does it work in test mode?

Yes. Lantern detects whether the key is live or test and reads from the matching environment.

Other payment providers

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