# Which source made money?

Piotr Kulpinski · 30 Nov 2026 · 2 min read · Guide · https://highseat.com/blog/which-source-made-money

A Stripe payment reaches Highseat through a webhook, often days after the visit. One id passed to your checkout joins the two.

Most analytics tools stop counting at the signup. The money arrives later, in Stripe, and the two never meet. Highseat records each payment against the visit that led to it, so every breakdown can show revenue beside visitors.

## The attribution id

The tracker gives every visit an attribution id. `getAttributionId()` resolves to it, and your checkout passes it to Stripe as `attribution_id` metadata.

```ts file="checkout.ts" highlight="await createCheckout"
import { getAttributionId } from "highseat"

const attributionId = await getAttributionId()
await createCheckout({ metadata: { attribution_id: attributionId } })
```

> [!NOTE] Never blocks a checkout
> If the tracker has not loaded within three seconds, the call resolves to `undefined` and the checkout goes ahead without the id.

## When the buyer signs in first

A buyer who visits on Monday and pays on Friday looks like two visitors. `identify()` links both visits to one user id from your own system, so the payment still finds its source. Most sites pass the signed-in user's id to the component instead, and the package calls `identify()` each time it changes.

```tsx file="app/layout.tsx" highlight="<Highseat"
import { Highseat } from "highseat/next"

<Highseat site="site_…" userId={user?.id ?? null} />
```

> [!WARNING] Pass an id, never an email
> Use the id from your own database. An email address or any other personal data does not belong in `identify()`.

## What the dashboard shows

Revenue appears on every breakdown, net of refunds, so a source that sends few visitors but many buyers stands out. A refund comes off the sale it belongs to.

![A site's dashboard over the last 30 days: visitors, sessions, views and revenue, with Pages and Sources each showing a revenue column beside their visitors.](which-source-made-money.webp "Revenue sits beside visitors in every breakdown.")

## Setting it up

1. Connect Stripe or Polar under Revenue in your site's settings.
2. Pass the attribution id to every checkout you create.
3. Identify signed-in users, through `userId` or `useIdentify()`.

With a provider connected, send `purchase` from the page without `revenue`. The webhook already records the money, and sending both counts the sale twice. The [payment provider guide](/docs/payment-providers) walks through each provider's webhook.
