Skip to content

Tracking Overview

Affitor tracking captures the complete customer journey—from the first click on an affiliate link to the final purchase.


When a partner shares their affiliate link, Affitor tracks three key events:

EventWhat it capturesWhen it fires
ClickVisitor arrives via affiliate linkPage load with ?ref= parameter
SignupVisitor registers or submits a formYour signup form completion
SaleCustomer completes purchaseStripe payment success

Each event is linked together using tracking cookies, so you always know which partner drove which sale.


graph LR
A[Partner Shares Link] --> B[Customer Clicks]
B --> C[Visits Site]
C --> D[Signs Up]
D --> E[Purchases]
A -.->|Unique ?ref= URL| A1[Unique link]
B -.->|Cookie set| B1[Click tracked]
C -.->|60 day cookie| C1[Cookie persists]
D -.->|trackLead called| D1[Lead tracked]
E -.->|Stripe metadata| E1[Sale tracked]

Step by step:

  1. Partner gets unique link: https://yoursite.com?ref=PARTNER123
  2. Customer clicks: Affitor script detects ?ref= parameter
  3. Cookie stored: customer_code saved (60-days lifetime)
  4. Customer browses: Cookie persists across sessions
  5. Customer signs up: You call trackLead() with user_id → linked to customer
  6. Customer purchases: Stripe metadata with user_id captures sale → commission created

Three integrations connect your site to Affitor:

IntegrationPurposeDifficulty
Pageview TrackerTrack clicks from affiliate linksEasy – npm install or one script tag
Lead TrackingTrack signups and registrationsEasy – one function call
Payment TrackingTrack sales via StripeMedium – metadata setup

Most advertisers complete all three in under 30 minutes.

MethodInstallBest for
npm SDK (@affitor/tracker)npm install @affitor/trackerReact, Next.js, Vue, any JS/TS app
Script tagCopy-paste <script> tagStatic HTML, WordPress, no-build sites

Both methods provide the same tracking functionality. The npm SDK adds TypeScript types, Promise-based loading, and React hooks.


Affitor uses last-click attribution with cookie-based tracking.

When a customer clicks an affiliate link:

  1. customer_code created and stored in cookie
  2. Customer-partner relationship created in database
  3. Cookie lasts 60 days
  4. Attribution window is 60 days from first click
  5. Any purchase within window credits that partner

If a customer clicks Partner A’s link, then later clicks Partner B’s link:

  • Partner B gets credit (last-click wins)
  • Cookie is overwritten with new customer code

DataSourcePurpose
customer_codeAuto-generated on first clickIdentify visitor & link events together
program_idYour program IDRoute to correct program
TimestampAutomaticWhen event occurred
User agentBrowserAnalytics
IP addressRequestFraud detection
CookieValueLifetime
customer_codeUnique visitor ID60 days

Cookies are set automatically by the tracker script. No action required.


Affitor tracking uses first-party cookies on your domain. You should:

  1. Include in cookie policy: Mention affiliate tracking cookies
  2. Cookie consent: If required in your jurisdiction, include in consent flow
  3. Data retention: Tracking data follows your Affitor program settings

Affitor doesn’t:

  • Use third-party cookies
  • Share data with ad networks
  • Track users across other sites

Set up tracking in order:

  1. Pageview Tracker – Capture clicks (5 minutes)
  2. Lead Tracking – Capture signups (10 minutes)
  3. Payment Tracking – Capture sales (15 minutes)