---
id: "brand/tracking/tracking-overview"
type: "doc"
url: "https://affitor.com/docs/brand/tracking/tracking-overview"
---
# Tracking Overview

> How Affitor links clicks, signups, and sales together

Affitor tracking links three events into one attribution chain:

- **click** — a visitor arrives through an affiliate link
- **signup/lead** — you identify the customer after registration
- **sale** — revenue is recorded through Server-side tracking or Stripe integration

---

## The Core Model

Every successful integration follows the same three-step shape:

1. A tracked affiliate visit creates a click/customer relationship.
2. Signup tracking attaches your internal user ID to that relationship.
3. Sale tracking records revenue against the same customer/partner relationship.

Identifier consistency matters more than any single code snippet.

---

## The Tracking Flow

<Mermaid chart={`flowchart LR
  V["Visitor clicks partner link (?aff=CODE)"] --> S[Your site]
  S -->|SDK or script tag| CK[Click event]
  S -->|signup| LD[Lead event]
  ST[Stripe webhook or S2S API] --> SL[Sale event]
  CK --> AT[Affitor attribution]
  LD --> AT
  SL --> AT
  AT --> CM[Commission for the partner]
`} />

<Flow>
  <FlowStep>Partner shares link</FlowStep>
  <FlowStep>Customer clicks</FlowStep>
  <FlowStep>Tracker stores `affitor_click_id`</FlowStep>
  <FlowStep>Customer signs up</FlowStep>
  <FlowStep>Your internal customer ID sent to Affitor</FlowStep>
  <FlowStep>Customer pays</FlowStep>
  <FlowStep>Server-side tracking or Stripe metadata path</FlowStep>
  <FlowStep>**Revenue attributed**</FlowStep>
</Flow>

---

## What You Need to Implement

### 1. Click tracking

Install the tracker so affiliate visits are detected automatically:

- Detects `?aff=`
- Stores `affitor_click_id`
- Creates the initial relationship Affitor needs for attribution

Guide: [Click Tracking](/docs/brand/tracking/click-tracking/)

### 2. Signup tracking

Send your internal customer/user identifier after signup succeeds.

- browser helper: `signup(customerKey, email)`
- server API: `POST /api/v1/track/lead` with `customer_key`

Guide: [Lead Tracking](/docs/brand/tracking/lead-tracking-signup/)

### 3. Sale tracking

Choose one supported revenue path:

| Path | Use when |
|------|----------|
| **Server-side tracking** | your backend controls revenue events |
| **Stripe metadata + webhook** | you already use Stripe Checkout / Stripe integration |

Guide: [Payment Tracking](/docs/brand/tracking/payment-tracking-stripe/)

---

## Recommended Identifier Mapping

| Context | Field |
|--------|-------|
| Signup helper | `customerKey` |
| Lead API | `customer_key` |
| Server-side tracking | `customer_key` |
| Stripe metadata | `affitor_customer_key` |
| Browser click cookie | `affitor_click_id` |
| Server-side tracking click field | `click_id` |

Use one stable internal customer ID everywhere.

---

## Attribution Basics

### Default model

Defaults:
- first-party cookie tracking
- **the first partner's click keeps the customer**: a later click from another partner in the same browser is logged but does not take the customer over
- **attribution window**: 60 days per program by default, one setting. The click must be at most that many days older than the customer's signup (or their first payment, when no signup was recorded). It is checked once, at the first attributed payment; renewals are not re-checked. The same number is the cookie lifetime.

See [Attribution Mechanics](/docs/api-reference/attribution/) for details.

### Why the signup step matters

The click cookie is reliable, but the internal customer ID is what keeps attribution working across later payment events — especially when payment happens after signup or on a backend-controlled path.

---

## One-Time vs Subscription Payments

### One-time payment

Choose either:
- Send a server-side tracking event (POST /api/v1/track/sale) after payment succeeds.
- Attach Stripe metadata for Stripe integration.

### Subscription payment

If you use Stripe subscriptions:
- Include metadata on the checkout session.
- Include the same metadata on `subscription_data.metadata`.

Without subscription metadata, renewals may not be attributable.

---

## What Most Teams Choose

### Fastest path for Stripe Checkout teams (manual)

1. install tracker
2. send the lead from your backend with `POST /api/v1/track/lead` and your program API key (a browser-only `signup()` lead stays provisional on new programs)
3. attach Stripe metadata for payment + subscription flows

### Fastest path for custom backend teams (manual)

1. install tracker
2. send the lead from your backend with `POST /api/v1/track/lead` and your program API key
3. send `POST /api/v1/track/sale` from your backend

---

## Related Guides

1. [Click Tracking](/docs/brand/tracking/click-tracking/)
2. [Lead Tracking](/docs/brand/tracking/lead-tracking-signup/)
3. [Payment Tracking](/docs/brand/tracking/payment-tracking-stripe/)
4. [Testing Integration](/docs/brand/tracking/testing-integration/)
