Track sales
Tracking Overview
How Affitor links a partner click, your customer's signup and the sale into one attribution chain, step by step from referral link to commission.
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:
- A tracked affiliate visit creates a click/customer relationship.
- Signup tracking attaches your internal user ID to that relationship.
- Sale tracking records revenue against the same customer/partner relationship.
Identifier consistency matters more than any single code snippet.
The Tracking Flow
affitor_click_idFrom Click to Commission
1. Partner shares a referral link
A partner promotes your product with a referral URL such as:
https://yoursite.com?via=PARTNER123Programs created from October 16, 2026 (UTC) use ?via= unless you pick ?aff= in Partner link parameter under Program settings › Tracking; older programs keep ?aff=.
2. Click tracking
Install the tracker so affiliate visits are detected automatically:
- Detects
?via=or?aff=(affwins when a URL has both) - Records the click and stores
affitor_click_idin a first-party cookie - Links the visit to the correct partner/program, the initial relationship Affitor needs for attribution
Guide: Click Tracking
3. Signup tracking
Send your internal customer/user identifier after signup succeeds.
- browser helper:
signup(customerKey, email) - server API:
POST /api/v1/track/leadwithclick_idandcustomer_key
By default a browser signup() records a provisional lead, which does not bind your identifier to the customer record for later sale matching (the Lead tracking section shows "Browser leads: server/payment confirmation required"). Send the same lead from your server with your API key (POST /api/v1/track/lead with click_id and customer_key) so the identifier is stored for later matching.
Reuse that same identifier as customer_key in server-side tracking and as affitor_customer_key in Stripe metadata.
Guide: Lead Tracking
4. Sale tracking
Choose one supported revenue path:
| Path | Use when |
|---|---|
| Server-side tracking | your backend controls revenue events |
| Stripe integration | you already use Stripe Checkout / Stripe integration |
With server-side tracking, your backend calls POST /api/v1/track/sale when payment succeeds. For a real server-side sale, customer_key matches a key already stored on a customer in your program, for example by a server-verified lead or an attributed Stripe payment. If the key has not been stored, send a matching click_id; otherwise the request returns 400 Customer not found.
With the Stripe integration, you keep charging in your own Stripe account and attach Affitor metadata.
Guide: Stripe, for both paths
5. Affitor attributes the sale
Affitor must be able to resolve the customer of a server-side sale via customer_key or click_id. A Stripe payment goes through a lookup order, from the click in the metadata to the customer key: how Affitor resolves attribution from Stripe.
6. Commission and platform records are created
After attribution and payment-admission checks pass, Affitor records the sale. Commission creation can be held when the payment cannot be priced. Eligible commissions follow the program's hold and approval rules; test, self-referral and other held commissions have separate rules. See the cash-flow guide for approval, invoice funding and withdrawal conditions.
How you are billed for it: Pricing.
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 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.
On your own Checkout Session, put the click in subscription_data.metadata so it reaches the invoices. Without a click in invoice metadata, Affitor can still match an existing customer or use a valid Affitor client_reference_id from the subscription's Checkout Session, subject to account and program checks.
What Most Teams Choose
Fastest path for Stripe Checkout teams (manual)
- install tracker
- send the lead from your backend with
POST /api/v1/track/leadand your program API key (a browser-onlysignup()lead stays provisional by default) - attach Stripe metadata for payment + subscription flows
Fastest path for custom backend teams (manual)
- install tracker
- send the lead from your backend with
POST /api/v1/track/leadand your program API key - send
POST /api/v1/track/salefrom your backend