Overview#
Connecting Stripe to Eleven gives you financial clarity. Instead of guessing whether an advertising campaign or blog post worked based on vanity pageviews, Eleven reconciles incoming Stripe charge events against cookieless visitor sessions.
---
Quick Setup Guide#
Step 1: Add the Eleven Script to Your Site#
Add the standard 1KB Eleven embed snippet to your website header:
<!-- Eleven Analytics Tracking Snippet --><script defer data-domain="yourdomain.com" src="https://cdn.elevenanalytics.io/script.js"></script>Step 2: Pass the Session ID to Stripe Checkout#
When redirecting users to Stripe Checkout or opening an Embedded Form, pass Eleven's client session identifier in the client reference metadata:
import Stripe from "stripe";const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);export async function createCheckoutSession(userId: string) { const session = await stripe.checkout.sessions.create({ payment_method_types: ["card"], mode: "subscription", line_items: [ { price: "price_premium_monthly", quantity: 1, }, ], // Pass Eleven attribution session metadata client_reference_id: userId, metadata: { eleven_ref: "auto", // Automatically matches server-side }, success_url: "https://yourdomain.com/dashboard?session_id={CHECKOUT_SESSION_ID}", cancel_url: "https://yourdomain.com/pricing", }); return session.url;}Step 3: Add the Webhook in Stripe Dashboard#
- Go to your Stripe Dashboard → Developers → Webhooks.
- Click Add destination and enter your Eleven Webhook URL:
https://api.elevenanalytics.io/v1/webhooks/stripe
- Select the following events:
checkout.session.completedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paid
---
Verification & Live Reporting#
Once your webhook is registered, test with a Stripe test-mode transaction. You will immediately see:
- Real-time conversion ping on your Eleven dashboard
- Acquisition source and referrer tag attached to the revenue
- Net MRR increase credited to the campaign