Affiliate tracking explained: how a link click becomes a commission
Affiliate tracking connects a partner's link click to a paid sale. 6 handoffs, 4 methods and 10 checks show how links and cookies work and where each leaks.
Muzahid Maruf, FounderUpdated
On this page
- 01What does an affiliate link mean?
- 02How does affiliate tracking work, from click to commission?
- 03What are the 4 ways to track a referral?
- 04Which partner gets the credit when several links touch one buyer?
- 05How do you use an affiliate link as a partner?
- 06Where does affiliate tracking break?
- 07Which 10 checks should you run on your own tracking?
- 08What does TrackRev do for affiliate tracking?
Explore with AI
Opens this article inside the chosen assistant with a ready-made prompt.
Affiliate tracking is the process of recording which partner's link a customer clicked and crediting that partner when the customer pays.
The merchant's server logs the click and sets a visitor ID cookie, and a Stripe webhook later matches the payment back to that visitor.
6 handoffs sit between click and commission, and a failure at any one, from an Apple Safari cookie rule to a missing Stripe Checkout field, files the sale under direct.
Key takeaways
- 6 handoffs connect a click to a commission, and a failure at any one files the sale under direct.
- Safari 12.1 capped script-written cookies at 7 days in 2019. Save the visitor ID at signup so no cookie has to survive until the first payment.
- Stripe carries the visitor ID in a Checkout Session reference field or in metadata. With neither, the webhook has no click to match.
What does an affiliate link mean?
An affiliate link is an ordinary web address with a partner ID attached, such as ?ref=jane, go.acme.com/jane or the tagged link formats that Amazon Associates' operating agreement, updated October 15, 2025, requires.
The merchant's system must read the ID, store it and match it to a payment days or weeks later.
An affiliate link therefore has 3 jobs: carry the partner ID, deliver the visitor to the merchant's page, and leave a record the payment can find.
A link that does the first two jobs but not the third produces clicks and no commission. The Federal Trade Commission's Endorsement Guides Q&A describes the partner's side: link to a retailer, earn a commission when a reader buys.
How does affiliate tracking work, from click to commission?
Affiliate tracking is a chain of 6 handoffs between a partner's link and a Stripe payment. First, a redirect on the merchant's domain logs the click. Second, the server sets a visitor ID cookie.
Third, signup saves the ID beside the email. Fourth, payment creation writes the ID onto the Stripe Checkout Session. Fifth, Stripe sends a webhook for each paid invoice. Finally, a matching job finds the click and applies the credit rule.
A break at any handoff files the sale under direct, which is why the 10 checks later in the post test each handoff in turn.
| Step | What happens | What gets recorded |
|---|---|---|
| 1 | A click on go.acme.com/jane reaches a redirect on the merchant's domain | Partner, from the slug |
| 2 | The server logs the click and marks bots so they earn no credit | Partner, timestamp, user agent, referrer, visitor ID |
| 3 | The server answers 302 with a Set-Cookie header, often with Max-Age=31536000 | Visitor ID in a cookie, often in the URL too |
| 4 | Signup saves the ID, and payment creation writes it onto the Stripe Checkout Session | User record; client_reference_id (200 characters) |
| 5 | Stripe sends checkout.session.completed, then invoice.paid per invoice | Charge amount and ID at the webhook endpoint |
| 6 | A matching job finds the click, applies the credit rule and the rate | Ledger row; a refund writes the reversal |
What happens when a referral pays on day 41?
A late referral is a sale that pays long after the click, and day 41 shows the risk. Take a partner named Jane on a 30% recurring commission and a $49 monthly plan (illustrative numbers).
A visitor clicks her link on a Tuesday, signs up 5 days later and makes the first payment 41 days after the click.
| Day | Event | What the match uses |
|---|---|---|
| 0 | Click on go.acme.com/jane | Click row and visitor ID from the redirect |
| 5 | Signup with a new email | ID copied to the user record beside the email |
| 41 | First payment, $49 | ID on the Checkout Session; the click is 41 days old |
| 71 | Second payment, $49 | Renewal inherits the first payment's credit |
A 30-day cookie window would have closed 11 days before the first payment, and the sale would be filed as direct.
With a 60-day window the first payment earns Jane $14.70 ($49 × 0.30), and a customer who stays 12 months earns her 12 × $14.70 = $176.40. Lose the ID at day 41 and all $176.40 goes with it.
| Months the customer stays | Revenue at $49 | Jane's commission at 30% |
|---|---|---|
| 1 | $49 | $14.70 |
| 3 | $147 | $44.10 |
| 6 | $294 | $88.20 |
| 12 | $588 | $176.40 |
Illustrative figures for the day-41 customer. The ID decides whether every row is credited or none.
| Cookie window | Closes relative to the day-41 payment | First commission at 30% |
|---|---|---|
| 30 days | 11 days before | $0, filed as direct |
| 45 days | 4 days after | $14.70 |
| 60 days | 19 days after | $14.70 |
| 90 days | 49 days after | $14.70 |
Same $49 sale, four window settings. Only the first setting loses the credit.
What are the 4 ways to track a referral?
A tracking method is the key used to match a payment to a partner.
Link and cookie matches on a visitor ID, coupon code on a personal code, postback on a network click ID, and email match on the address saved at signup.
Link and cookie is the default for SaaS because the buyer takes no extra step. Coupon codes cover audio and print, where nothing can be clicked. Postback suits partners who bring a network.
For example, a podcast host with no link to click can still earn through a personal code typed at checkout.
| Method | Matched on | Typical gap |
|---|---|---|
| Link and cookie | Visitor ID in a cookie | Safari deletes script-written copies after 7 days |
| Coupon code | Personal code on the discount | The customer has to type it, and a shared code credits 0 partners |
| Postback | Click ID from a network | 1 call per sale to the network, plus development work to carry the ID to payment |
| Email match | Email saved at signup | Buyer pays with a different address |
Which partner gets the credit when several links touch one buyer?
A credit rule is the policy that picks one partner, or splits the commission, when several links touch one buyer.
Say a visitor clicks 3 partners' links (A on day 1, B on day 10, C on day 20) and pays $49 on day 21. The credit rule decides who earns the 30% commission, which is $14.70 in total.
The table shows 3 rules and 3 outcomes, and the attribution models comparison has the trade-offs. Because all three rules pay out the same $14.70, the choice moves money between partners, never between the partners and the merchant.
| Rule | Who is credited | Commission on $49 at 30% |
|---|---|---|
| Last click | Partner C | $14.70 to C |
| First click | Partner A | $14.70 to A |
| Shared | A, B and C equally | $4.90 each |
| Plan price | Monthly commission at 30% | 12-month commission at 30% |
|---|---|---|
| $19 | $5.70 | $68.40 |
| $49 | $14.70 | $176.40 |
| $99 | $29.70 | $356.40 |
| $199 | $59.70 | $716.40 |
What one lost visitor ID costs at four plan prices, assuming the customer stays 12 months.
How do you use an affiliate link as a partner?
Using an affiliate link means sharing the exact address the partner dashboard issues. First, use the link exactly as issued, since a shortener or an edited ID can drop the ID.
Second, check in a private window that the landing address still carries the ID. Third, disclose the commission. The Federal Trade Commission's Endorsement Guides Q&A suggests wording such as "I get commissions for purchases made through links in this post".
Audio and print need a different path, so a personal coupon code covers those formats. Under the Endorsement Guides the commission should be disclosed close to the recommendation, and "affiliate link" alone may not be understood; see the compliance guide.
Where does affiliate tracking break?
Browser rules are the first place to look. Statcounter's September 2026 data puts Safari at 46.38% of US mobile browser use, 1.06 points behind Chrome's 47.44%.
A browser rule is a setting that limits how long a cookie lives or whether it travels across sites. Four rules matter for partner cookies, listed in the table with the version that introduced each one.
The Safari ITP post covers the Safari rules in depth.
| Rule | Version and announcement date | Effect on a partner cookie |
|---|---|---|
| Script-cookie cap | Apple Safari 12.1 and iOS 12.2, Feb 21, 2019 (Intelligent Tracking Prevention 2.1) | Cookies created through document.cookie get a 7-day expiry cap |
| Link-decoration cap | iOS 12.3 and macOS 10.14.5, Apr 24, 2019 (ITP 2.2) | 1 day, when a classified tracker sent the visitor and the URL has a query string or fragment |
| Third-party block | Safari 13.1 and iOS 13.4, Mar 24, 2020 | Cookies for cross-site resources are blocked by default |
| Partitioning | Mozilla Firefox 86 (Strict mode), 90 (private windows), 103 (all users) | Cookies are keyed to the top-level site, so a network's cookie does not follow the visitor between merchants |
Sources: WebKit's ITP 2.1, ITP 2.2 and Safari 13.1 posts, and MDN's State Partitioning page.
WebKit's tracking prevention page now words the 7-day rule as deletion after 7 days without user interaction.
A cookie your own server sets in a Set-Cookie header sits outside it, and the click row in your own database is untouched by browser rules. In MDN's Set-Cookie reference Max-Age counts seconds, so the 31536000 below is 365 days.
HTTP/1.1 302 Found
Location: https://acme.com/pricing?_vid=3f6c9a52-81d4-4c0e-9a77-5b2f1de0a4c8
Set-Cookie: vid=3f6c9a52-81d4-4c0e-9a77-5b2f1de0a4c8; Max-Age=31536000; Domain=acme.com; Path=/; Secure; SameSite=LaxWhy do cookies miss the checkout?
A cookie set on www.acme.com with no Domain attribute is readable only on that host. Domain=acme.com shares it with app.acme.com, but a Stripe-hosted checkout usually sits on another registrable domain, so the ID must travel in the request.
Stripe offers 3 places to put it, listed in the table with the limit on each. A cookie is scoped to a host, and a hosted checkout is a different host, so the checkout never sees the cookie.
The same failure appears with a Stripe Payment Link, because the link opens on a Stripe domain.
| Field | Limit | Where it comes back |
|---|---|---|
Checkout Session client_reference_id | 200 characters | checkout.session.completed |
| Metadata on a Stripe object | 50 keys, 40-character keys, 500-character values | Events for that object |
| Payment Link URL parameter | 200 characters of letters, digits, - and _ | The same event |
A Payment Link silently drops an invalid value, so a UUID passes and an ID with a dot or an @ vanishes without an error.
Why do windows shorter than the sales cycle lose sales?
A cookie window shorter than the sales cycle is the most common cause of lost credit, because the window closes before the buyer pays. In our program setup the window starts at 60 days and accepts 1 to 3,650.
Choose yours from data. First, pull the last 100 paying customers. Second, compute the days from first partner click to first payment. Third, set the window just past the 90th percentile.
If 90 of the 100 paid within 62 days, 75 days covers them with margin, while 365 days starts crediting clicks that played no part in the decision.
Jane's day-41 payment in the earlier example shows the cost: a 30-day window loses $176.40 over 12 months.
How do webhooks handle renewals?
Stripe's webhook documentation sets the rules. invoice.paid fires on every successful invoice, so a handler that listens only for checkout.session.completed pays a partner once and misses each renewal, as the subscription tracking guide explains.
A webhook is an HTTP call from Stripe to the merchant's server after each event.
The merchant's endpoint must answer with a 2xx status quickly, then do slow work afterward, because Stripe retries a failed delivery for up to 3 days in live mode.
Events can arrive out of order, so dedupe on the event ID.
| Rule | Value |
|---|---|
| Live-mode retries | Up to 3 days, with exponential backoff |
| Sandbox retries | 3 over a few hours |
| Manual resend | 15 days from the Stripe Dashboard, 30 days with the Stripe CLI |
| Ordering | Not guaranteed; dedupe on the event ID |
| Response | A 2xx before any slow work |
Which 10 checks should you run on your own tracking?
A tracking audit is a set of tests that follow one test visitor from the partner link to the ledger. The 10 checks run in order.
Checks 1 to 4 cover the click and the redirect, checks 5 and 6 cover the Stripe payment and the webhook, check 7 covers a visitor who switches devices, check 8 covers a refund, and checks 9 and 10 compare totals against the data you already hold.
Run all 10 after any change to the redirect, the checkout or the pixel.
Check 5 uses Stripe test card 4242 4242 4242 4242, and check 4 uses curl -I to count redirect hops, where 1 hop is the pass condition.
Two browsers cover the most common blockers, and bot traffic filtering keeps crawler clicks out of the counts.
| Check | Pass condition | If it fails |
|---|---|---|
| 1. Fresh Safari window, your partner link | A visitor cookie is set; read its expiry in the Storage tab | A script-written cookie falls under the 7-day rule, so set it from the redirect and save the ID at signup |
| 2. Google Chrome with uBlock Origin on | The cookie is still set | A filter list matches your redirect or script host; serve it from your own domain |
| 3. Landing address after the redirect | The ID is still in the URL | A shortener or click wrapper dropped it; use a path slug |
4. curl -I on the link | 1 hop, a 302, before the landing page | Each extra hop is another place to lose the ID |
| 5. Stripe test card 4242 4242 4242 4242 | The Checkout Session shows the ID in client_reference_id or metadata | The field is missing, or a Payment Link dropped an invalid value |
| 6. Event deliveries for that payment | A 200 within seconds | The endpoint is failing; see the retry rules above |
| 7. Phone click, then laptop signup and payment with 1 email | The sale reaches the partner | A cookie belongs to 1 browser, so match on the signup email |
| 8. Refund the test payment | The commission reverses | Refunds are not reaching the ledger |
| 9. Last 30 days of partner-referred charges | Count those carrying a visitor ID | Organic signups carry none, so judge only the referred set |
| 10. Click counts from your 3 biggest partners | Close to your own log | More clicks on their side point upstream, at a blocked script or stripped parameter; equal clicks with missing sales point downstream, at the cookie, the payment field or the webhook |
What does TrackRev do for affiliate tracking?
TrackRev is SaaS affiliate software for indie hackers and small SaaS teams. Each partner link in the redirect we built is a server-side redirect on a TrackRev domain or a custom tracking domain with 1 CNAME record.
The redirect logs the click, flags bots, sets the vid cookie for 365 days and passes the ID to your page as _vid. A pixel on your site tags Stripe Payment Links, Buy Buttons and pricing tables.
At payment the pixel reads the ID from charge metadata, then the Checkout Session, then the customer's email if your site called trk.identify(email).
The pixel's cookie is written by JavaScript, so Safari's 7-day rule applies to the pixel cookie, while the click log stays on the server.
One workspace-wide rule sets credit: last click, first click or shared. Each program sets its own cookie window and hold, from 0 to 180 days. Personal coupon codes credit partners who cannot use links.
| Setting | Value in TrackRev |
|---|---|
| Visitor cookie lifetime | 365 days, set by the redirect |
| Cookie window per program | 60 days by default, 1 to 3,650 allowed |
| Hold on new commission | 0 to 180 days, default 0 |
| Revenue processors | 6 billing systems |
| Credit rules | 3: last click, first click, shared |
Tracking settings described in this section.
| Plan | Price | Affiliate program | Commission tracked |
|---|---|---|---|
| Free | $0 | Locked; link tracking only, with 50 links and 1,000 events a month | None |
| Indie | $29 a month | Unlocked, 1 workspace and 1 tracked domain, solo | No cap |
| Growth | $299 a year | Unlocked, up to 10 workspaces and 10 tracked domains, unlimited team members | No cap |
From the pricing page. Indie bills monthly and Growth bills yearly.
Skip TrackRev if an affiliate network's contract makes its pixel the record for disputes.
TrackRev reads revenue from Stripe, Paddle Billing, Polar, Lemon Squeezy, Creem and Dodo Payments, with no limit on tracked revenue and 0% fees on it, as our own pricing page states.
The 8-step build is in affiliate tracking without third-party cookies, and the affiliate program page covers links and payouts.
Found this useful? Share it.
Frequently asked questions
- A normal URL plus a partner ID, such as acme.com/pricing?ref=jane. The visitor sees the same page, and only the merchant's click log shows the visit came from Jane.
- No. A $49 plan costs $49 through Jane's link, and her 30% commission of $14.70 comes from the merchant's revenue. Only a coupon changes the price.
- As long as the program sets it, up to the browser's limits. In our setup form the window starts at 60 days and accepts up to 3,650, and Safari can delete a script-written copy after 7 days.
- Run 1 payment with the Stripe test card, confirm the visitor ID reached the Checkout Session, then confirm the webhook got a 200.
- For link tracking, no: click capture needs no script. Revenue matching adds 1 pixel tag, and a Checkout Session from your own backend needs 1 line passing client_reference_id.
- In TrackRev a refunded or disputed charge takes its commission back out, and a hold of 0 to 180 days per program keeps new commission pending until your refund window passes.

Written by
Founder, TrackRev.io & Contant.io
Muzahid Maruf founded TrackRev.io, SaaS affiliate software with no limit on tracked revenue, and Contant.io. He writes about affiliate programs.
Writes about Marketing attribution · Link tracking · Revenue analytics · SaaS growth
Run your affiliate program without a revenue cap.
Affiliate software for indie hackers and small SaaS teams: $29 a month flat, 0% fees, link tracking and revenue attribution built in. Free to start, no card.