Revenue attribution

Link payments to the traffic sources that generated them. attribu.tech tracks visitors from first click to purchase, so you know exactly which channels drive revenue.

How it works

  1. A visitor lands on your site. The pixel sets an attribu_visitor_id cookie and records their source (UTMs, referrer, ad click IDs).
  2. The visitor browses your site. Every pageview is tied to their visitor ID.
  3. The visitor clicks "Buy". Your checkout passes the attribu_visitor_id and attribu_session_id cookies as Stripe metadata.
  4. Stripe processes the payment and fires a webhook. attribu.tech saves the charge with the visitor ID from the metadata.
  5. The dashboard joins the charge to the visitor's first-touch event and shows which source drove the revenue.
The visitor ID cookie traveling through Stripe metadata IS the attribution link. No email matching or identity resolution needed.

Stripe Checkout API

When creating a Checkout Session on the server, pass the attribu.tech cookies as metadata. Here is an example using Next.js App Router:

// 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: "payment", // or "subscription"
    line_items: [{ price: "price_xxx", quantity: 1 }],
    success_url: "https://yourdomain.com/success?session_id={CHECKOUT_SESSION_ID}",
    cancel_url: "https://yourdomain.com/",
    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 field must be on the Checkout Session itself, not on the line item or product. attribu.tech reads session-level metadata from the webhook.

Stripe PaymentIntent API

If you create PaymentIntents directly instead of using Checkout Sessions, pass the cookies the same way:

// app/api/payment/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 { amount } = await req.json();
  const cookieStore = await cookies();

  const paymentIntent = await stripe.paymentIntents.create({
    amount,
    currency: "usd",
    metadata: {
      attribu_visitor_id: cookieStore.get("attribu_visitor_id")?.value || "",
      attribu_session_id: cookieStore.get("attribu_session_id")?.value || "",
    },
  });

  return Response.json({ clientSecret: paymentIntent.client_secret });
}

Stripe Payment Links

If you use Stripe Payment Links, no extra code is needed. The attribu.tech pixel automatically detects the ?session_id=cs_xxx parameter on your success page and sends a payment event to your dashboard.

Just make sure your Payment Link redirects to a success page on your domain where the pixel is installed. Stripe appends ?session_id=cs_xxx to the URL automatically.

Payment Links are the easiest path to revenue attribution. No code changes, no metadata to pass. Install the pixel and you're done.

What you'll see

Once payments are flowing, your attribu.tech dashboard shows revenue broken down by:

  • Source - Google, Facebook, Twitter, newsletter, direct, etc.
  • Campaign - Which ad campaign or UTM campaign drove the sale
  • Channel - Paid Search, Organic Social, Email, Referral, etc.
  • Country - Where the paying customer is located
  • Landing page - Which page the customer first visited

You can see total revenue, number of paying customers, and average order value for each dimension.

What's next

Copied