Revenue

Revenue attribution

Revenue attribution ties each payment back to the visit that earned it, so you can see revenue per channel instead of just traffic per channel. This is what lets you answer "which campaign actually made money," not only "which campaign got clicks."

How a payment finds its visit

When a payment lands, Clickbase matches it to a visitor and, through that visitor's first session, to the campaign and source that drove them in. That attribution flows into the Revenue page and into your breakdowns, so filtering by a source or a UTM campaign shows the money it produced alongside the traffic.

Attribution is anchored to the visit that brought the visitor in, so revenue is credited to the acquisition channel — the referrer, UTM, or source of the session — rather than to whatever page the payment happened on.

Unattributed revenue

Some payments can't be matched to a visit. When that happens the revenue still counts toward your totals — it just lands under Unattributed instead of being credited to a channel. Common causes:

  • The purchase came from a server-side flow (like a Stripe Checkout Session) that was never linked back to the browser visit.
  • The visitor was never tracked (ad blocker, tracking disabled, a channel Clickbase never saw).

Unattributed is normal to some degree. If it's a large share of your revenue and you use server-side checkout, the bridge below usually fixes it.

Bridging a server-side checkout

A Stripe Checkout Session is created on your server, so on its own it has no idea which browser visit it belongs to. You close that gap by reading the visitor id in the browser and attaching it (and optionally the session id) to the session.

// 1. In the browser, ask the tracker for the visitor id
//    (never read the cookie yourself) and send it to your server.
const visitorId = window.clickbase?.getVisitorId?.() ?? null;
const sessionId = window.clickbase?.getSessionId?.() ?? undefined;

// 2. On your server, attach them to the Checkout Session.
const session = await stripe.checkout.sessions.create({
  // ...line_items, mode, success_url
  metadata: {
    clickbase_visitor_id: visitorId,
    ...(sessionId ? { clickbase_session_id: sessionId } : {}),
  },
  // Subscription mode: also copy onto the Subscription so MRR
  // attribution can stamp first-touch at subscribe time.
  subscription_data: {
    metadata: {
      clickbase_visitor_id: visitorId,
      ...(sessionId ? { clickbase_session_id: sessionId } : {}),
    },
  },
});

When the payment completes, Clickbase reads that visitor id and matches the money back to the visit that earned it. getVisitorId() returns null before the tracker has loaded, and for a visitor with no stored id — in which case the payment simply lands under Unattributed rather than failing. getSessionId() is optional companion metadata; when present it is stored alongside the visitor. See Track revenue for the end-to-end flow.

Verified only

Attribution here is about verified revenue — money confirmed by Stripe or the Payments API. Reported revenue that your site sends from the browser attaches to goals, not to the Revenue page, and isn't part of channel revenue attribution. See Connect Stripe for the distinction.