Stripe revenue attribution

Tie paid customers back to the campaign that brought them in. Two steps: connect a read-only Stripe key in Analytise, then pass the visitor id with your checkout. No webhooks to configure — Analytise polls the payments for you.

1. Connect Stripe in Analytise

In your site's Settings → Integrations → Payments, paste an API key. Create it as a restricted key (Stripe Dashboard → Developers → API keys) with checkout sessions:read enabled — that's the only permission Analytise needs to read your paid payments.

  • Analytise validates the key immediately and starts a first sync that backfills the last year of payments.
  • Keys are encrypted at rest (AES-256-GCM), never rendered in the browser, and the sync can only read checkout sessions — nothing more.
  • A full secret key also works, but a restricted key follows your least-privilege policy.

2. Pass the visitor id into checkout

Wherever your server creates the Checkout Session, read the analytise_visitor cookie the tracker set and send it as metadata.analytise_visitor_id. The two marked lines are the only additions to a normal checkout:

app/api/checkout/route.js (Next.js)
import { cookies } from 'next/headers';
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

export async function POST(req) {
  const visitorId = (await cookies()).get('analytise_visitor')?.value; // ← required

  const session = await stripe.checkout.sessions.create({
    mode: 'subscription', // or 'payment'
    line_items: [{ price: 'price_xxx', quantity: 1 }],
    metadata: {
      analytise_visitor_id: visitorId, // ← required
    },
  });
  return Response.json({ url: session.url });
}

Why a cookie?

Stripe Checkout runs on Stripe's own domain, so the visitor id can't come from your analytics payload — it has to travel with the checkout session. The tracker writes its visitor token to the first-party analytise_visitor cookie (1 year), so the same id survives from first visit to purchase even weeks later.

What you'll see

Within a few minutes the payment appears on the Conversions page with the channel, country and source of the matching visitor — plus its share of the revenue chart. Every synced payment is deduplicated by Stripe's payment id, and refunds-wave reruns never double-count.

  • Payments without the metadata still count toward revenue totals — they show as Direct.
  • Click any row to open the customer's full journey: sessions, pageviews and the exact path just before the payment.

Next

Dodo Payments revenue attribution