Skip to Content
Revenue & ConversionsAttribute revenue to visitors

Attribute revenue to visitors

Attribution is what connects a payment to the visit that caused it. With it, a sale in your conversions list shows the source, campaign, or referrer that brought the customer in, so you can tell which marketing actually pays for itself.

Snow links a Stripe customer to a Snow visitor. This does not happen automatically. You wire it up once, one of two ways below.

Both methods rely on the visitor id that the Snow tracker assigns. You pass that id to Stripe (at checkout) or to Snow (server-side); Snow uses it to tie the resulting payment back to the right visit.

Get the visitor id

On the client, the tracker exposes the current visitor’s id:

const visitorId = window.sa.getVisitorId();

You’ll pass this id along when you create the Stripe Checkout Session, or send it to the Identify API from your server.

Choose a method

When you create the Stripe Checkout Session, read the visitor id from window.sa.getVisitorId() and pass it into the session. You can attach it as the client_reference_id, or in metadata (and subscription metadata) under a key like sa_visitor_id.

const visitorId = window.sa.getVisitorId(); // Send the visitor id to your server, which creates the Checkout Session. await fetch("/create-checkout-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ visitorId }), });

Then, on your server, include it when you create the session:

const session = await stripe.checkout.sessions.create({ mode: "subscription", // or "payment" line_items: [{ price: "price_123", quantity: 1 }], success_url: "https://example.com/success", cancel_url: "https://example.com/cancel", // Either of these links the payment back to the Snow visitor: client_reference_id: visitorId, metadata: { sa_visitor_id: visitorId }, // For subscriptions, also stamp it on the subscription itself: subscription_data: { metadata: { sa_visitor_id: visitorId }, }, });

Snow does not inject sa_visitor_id for you. You add it yourself when you create the Checkout Session. That’s the step that makes attribution work.

Requirements and limits

Attribution mode (the default)

Cross-session Stripe attribution works in attribution mode, which is on by default. In this mode the visitor id is stable across sessions, so a payment that happens later can still be tied back to the original visit.

Cookieless mode caveat

In cookieless mode, the visitor id rotates daily and lives only server-side, so there’s no stable id to hand to Stripe. That means cross-session Stripe attribution isn’t available in cookieless mode.

If linking visitors to revenue matters to you, keep the site in the default attribution mode rather than cookieless mode.

See it land

Once attribution is wired up, new payments in your conversions list will show the visit and source behind them. For more on identifying visitors generally, see Identify users.