> ## 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.

# Track your sales

> Install the seenpaid pixel so a sale on your own site gets matched to the post that drove the visit.

seenpaid matches a sale to a post when the payment carries the post's tracking id. The pixel does that for you: one script tag that keeps the id on your site and attaches it to checkout.

<Note>
  You need this only if buyers land on **your own site** before paying. Selling straight from a Stripe Payment Link opened from the tracked link? The id is carried through already.
</Note>

## Install the pixel

<Steps>
  <Step title="Copy your tag">
    In **Settings → Attribution** (attribution must be on), copy the tag:

    ```html theme={null}
    <script src="https://api.seenpaid.com/pixel.js"></script>
    ```
  </Step>

  <Step title="Paste it into your site's <head>">
    On every page where someone can buy, ideally site-wide:

    * **Framer:** Site Settings → General → Custom Code → head
    * **Webflow:** Project Settings → Custom Code → Head Code
    * **Carrd:** Settings → embed a Code element in the head
    * **Shopify:** theme.liquid, before `</head>`
    * **WordPress:** a header-scripts plugin, or your theme's header
  </Step>

  <Step title="Publish your site">
    That's it.
  </Step>
</Steps>

## What the pixel does

* Reads `cp_tid` from the landing URL and stores it first-party in a cookie **and** localStorage, so a visitor who lands on your homepage and buys from pricing later is still matched.
* Attaches the id to **Stripe Payment Links** (`buy.stripe.com`), **Stripe Buy Buttons** (`<stripe-buy-button>`) and **Stripe Checkout links** (`checkout.stripe.com`) automatically.
* Reports the click when you use own-URL link mode.
* Does nothing on a visit that didn't arrive from a tracked link.

## Two special cases

<AccordionGroup>
  <Accordion title="My checkout runs on a custom domain">
    Add `data-seenpaid` to the button or link so the pixel handles it:

    ```html theme={null}
    <a href="https://pay.yourbrand.com/abc" data-seenpaid>Buy now</a>
    ```
  </Accordion>

  <Accordion title="I create Checkout Sessions server-side">
    Read `window.seenpaidTrackingId` on the client, send it to your backend, and pass it as `client_reference_id`:

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

    `client_reference_id` is the only field seenpaid reads.
  </Accordion>
</AccordionGroup>

<Info>
  Want a mid-funnel event (an email capture, a signup) in your clicks → leads → sales funnel? Call `window.seenpaidTrackLead(email, kind)` or `window.seenpaidTrackGoal(name)` from your own button handler. Optional.
</Info>

## Check it's working

Open your site via a tracked link and run `window.seenpaidTrackingId` in the browser console. It returns the id. On a normal direct visit it returns `null`, which is correct. Once a real sale arrives, **Sales traced to a post** on Results shows the share that matched.

<Warning>
  Sales visible but a low traced share? The pixel is almost always missing from the page where people actually pay.
</Warning>

<Card title="How attribution works" icon="link" href="/how-attribution-works">
  The full click → sale → post chain.
</Card>


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