> ## Documentation Index
> Fetch the complete documentation index at: https://seenpaid.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to attribute Stripe sales to social posts

> Match a Stripe payment back to the social post that drove it: the tracked-link plus pixel method, explained, and how seenpaid does it for you.

**Short answer:** put a tracked link on each post, drop a small pixel on your site, and pass the click's tracking id into Stripe as `client_reference_id`. When the payment lands, match `client_reference_id → click → post`. seenpaid does this for you once [revenue attribution](/guides/turn-on-revenue-attribution) is on.

## Why it's hard by default

Every platform and scheduler shows likes, reach and clicks. None can tell you which post produced a paying customer, because the sale happens on a different surface (Stripe) than the post. To recover the link, one identifier has to survive the whole journey:

```
post → link click → your site → Stripe checkout → payment
```

## The method

<Steps>
  <Step title="Give each post a tracked link">
    A unique short link per post (for example `go.seenpaid.com/r/abc123`). The id in that link ties a future sale back to this post.
  </Step>

  <Step title="Record the click and keep the id">
    Log the click against the post and store the id first-party (a cookie plus localStorage) so it's still there when the visitor reaches checkout, even a few pages later.
  </Step>

  <Step title="Pass the id into Stripe">
    Attach it to the payment as **`client_reference_id`**. For Payment Links and Buy Buttons this can be automatic; for a server-side Checkout Session you set one field:

    ```js theme={null}
    const session = await stripe.checkout.sessions.create({
      // ...your existing params
      client_reference_id: trackingIdFromTheClick,
    })
    ```
  </Step>

  <Step title="Match the payment to the post">
    On the completed-payment webhook, read `client_reference_id`, find the click, find the post.
  </Step>
</Steps>

## The honest-attribution rule

If a payment arrives with no tracking id, or one that doesn't resolve to a click, **don't guess.** Leave it unattributed. Referrer matching, time-window last-touch and fingerprinting all produce a modelled number that makes the real number doubtful. Subtract refunds and chargebacks so a post's revenue reflects money you kept.

## How seenpaid does it for you

* **Tracked links** are minted when you publish (or your own URL gets a `cp_tid` parameter, your choice).
* **The pixel** (one script tag) keeps the id and attaches it to Stripe Payment Links, Buy Buttons and Checkout. See [Track your sales](/guides/track-your-sales).
* **Matching** runs off your connected revenue source via webhooks, including subscription invoices and refund reversals, and works the same way for Gumroad, Lemon Squeezy, Whop, Shopify, Paddle, Polar and Dodo Payments. See [Connect a revenue source](/guides/connect-stripe).
* **Sales traced to a post** on Results shows what share of your sales matched, so gaps never hide.

<Card title="Turn it on" icon="toggle-on" href="/guides/turn-on-revenue-attribution">
  Attribution is optional and off by default. Here's the switch.
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.