Stripe Subscriptions
Track recurring revenue and subscription lifecycle events. attribu.tech attributes every renewal, upgrade, and cancellation back to the original traffic source.
Make sure you've connected Stripe in your attribu.tech dashboard first. You need a restricted API key linked before payments can be attributed.
Passing metadata
When using Stripe Checkout for subscriptions, pass the attribu.tech cookies as metadata the same way you would for one-time payments. The only difference is mode: "subscription":
// app/api/checkout/route.ts
import { cookies } from "next/headers";
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
export async function POST(req: Request) {
const cookieStore = await cookies();
const session = await stripe.checkout.sessions.create({
mode: "subscription",
line_items: [{ price: "price_monthly_xxx", quantity: 1 }],
success_url: "https://yourdomain.com/success?session_id={CHECKOUT_SESSION_ID}",
cancel_url: "https://yourdomain.com/pricing",
metadata: {
attribu_visitor_id: cookieStore.get("attribu_visitor_id")?.value || "",
attribu_session_id: cookieStore.get("attribu_session_id")?.value || "",
},
});
return Response.json({ url: session.url });
}The metadata on the initial checkout session links the subscriber to their traffic source. All future subscription events (renewals, upgrades, cancellations) are automatically attributed to that same source.
Automatically tracked events
attribu.tech listens to Stripe subscription webhooks and records the following events as goals in your dashboard:
| Goal | Description |
|---|---|
payment | Every successful charge (initial and recurring) |
subscription_started | New subscription created |
subscription_renewed | Recurring payment succeeded |
subscription_upgraded | Customer moved to a higher-priced plan |
subscription_downgraded | Customer moved to a lower-priced plan |
subscription_cancel_scheduled | Customer scheduled cancellation at period end |
subscription_ended | Subscription fully canceled or expired |
These goals appear automatically in your dashboard once subscription events start flowing. You can use them in funnels, alerts, and filters like any other goal.
What you'll see
With subscriptions tracked, your attribu.tech dashboard shows:
- MRR by source -- which traffic channels generate the most recurring revenue
- Subscriber lifecycle -- upgrades, downgrades, and churn by source
- LTV -- total revenue per subscriber, attributed to first-touch source