Affiliate attribution and cookie duration explained
Updated · 5 min read
Affiliate attribution decides which partner gets credit for a customer, and the cookie duration sets how long after a click that credit can still apply. Most SaaS programs use last-click attribution with a 30 to 90 day window, backed by coupon codes and server-side tracking so the credit survives browser privacy limits.
What affiliate attribution means
When someone clicks a partner’s link, your tracking stores the partner’s referral code, usually in a first-party cookie on your domain. If that visitor later signs up and pays, the stored code tells you which partner referred them. That is attribution: a rule for connecting a customer to a partner, plus the data that makes the rule work.
In SaaS the rule has one extra job. The customer does not buy once; they pay every month. Good tracking attributes the customer at sign-up, stores that link on your server, and then credits every later payment from your billing system to the same partner, without needing the cookie again.
Three decisions shape the whole setup: which click wins when there is more than one, how long a click stays valid, and what counts as evidence besides a click, such as a coupon code.
First click or last click
Buyers of software often read several reviews before signing up, so more than one partner can send the same person. You need a tie-breaker, and there are two common ones.
| Model | Who gets credit | Strength | Weakness |
|---|---|---|---|
| Last click | The partner whose link was clicked most recently | Rewards the partner who closed the decision; the industry default | A late coupon or comparison site can take credit from the partner who introduced you |
| First click | The partner whose link was clicked first | Rewards discovery and long-form content | A casual early click can lock out the partner who actually persuaded the buyer |
| Split credit | Several partners share one commission | Feels fair on paper | Hard to explain, hard to audit, and rarely offered by affiliate tools |
Last click is what most partners expect, and what most affiliate software does: a new referral link overwrites the old cookie. Pick it unless you have a clear reason not to, and state it in your terms so partners know the rule before they promote you. Whatever you choose, apply it consistently; partners forgive a strict rule far more easily than a surprising one.
Coupon codes versus referral links
A referral link depends on a cookie surviving from click to sign-up. A coupon code does not: the buyer types it at checkout, and the code itself names the partner. That makes codes the best way to attribute podcast mentions, videos, newsletters and conversations, where nobody clicks anything.
- Give each partner their own code, so a code always points to one partner.
- Decide which wins if a buyer has a cookie for one partner and types another partner’s code. Most programs let the code win, because typing it is a deliberate act.
- Watch for codes leaking onto coupon sites, where they attribute buyers the partner never reached.
Affiliatops attributes a sale to the partner whose code is used even when there is no referral cookie at all, and lets you set the link window per program, 30 days by default. The docs show how links, codes and the tracking script fit together.
Cross-device, ITP and ad-blocker limits
Cookie-based attribution misses some referrals, and it is worth knowing where the gaps are so you do not over-promise to partners.
- Cross-device journeys: a buyer clicks a link on their phone and signs up on a laptop. The laptop has no cookie, so the link alone cannot connect them. Coupon codes and a login-based sign-up flow are the usual workarounds.
- Safari’s Intelligent Tracking Prevention (ITP) caps cookies set by JavaScript at about 7 days, no matter how long your program’s window is set to. A 90-day window means little if the browser deletes the cookie after a week — lean on coupon codes or server-side confirmation for anything longer.
- Ad blockers and privacy extensions may block third-party tracking scripts and requests to known tracking domains before they run.
- Private windows, cleared cookies and in-app browsers inside social apps all drop stored referrals.
None of these can be fully solved, and a tool that claims to track every referral is overselling. What you can do is reduce how much depends on a single cookie surviving.
Server-side tracking closes most of the gap
Server-side tracking moves the important steps off the browser. The browser only has to carry the referral code from the click to the sign-up; from then on, your server and your billing system do the work.
- 1
Capture the code at sign-up
When the visitor creates an account, send the stored referral code with the sign-up to your tracking backend, and save the customer–partner link there.
- 2
Record payments from billing webhooks
Stripe sends a webhook for every successful payment and refund. Matching those to the saved customer means renewals are credited with no cookie at all.
- 3
Serve tracking from your own domain
Cookies set by your server on your own domain tend to last longer than script-set ones, and first-party requests are less likely to be blocked.
The result is that the cookie only needs to survive the first visit to sign-up, usually minutes or days, instead of the full life of the customer. For the Stripe side of this in detail, see Stripe affiliate tracking.
Frequently asked questions
What is a good cookie duration for an affiliate program?
Commonly 30 to 90 days. Use 30 days for quick self-serve sign-ups and 60 to 90 days if buyers compare tools or need approval first. Check how long your own customers take from first visit to first payment before deciding.
Is affiliate attribution first click or last click?
Most affiliate programs use last click: if a visitor clicks links from two partners, the most recent click gets the credit. First click is less common. Either works if it is stated in your partner terms and applied consistently.
Do affiliate cookies work across devices?
No. A cookie lives in one browser on one device, so a click on a phone does not carry over to a sign-up on a laptop. Partner coupon codes and server-side attribution at sign-up are the usual ways to cover that gap.
Does Safari ITP affect affiliate tracking?
Yes. Safari’s Intelligent Tracking Prevention caps JavaScript-set cookies at about 7 days, no matter how long your program’s window is configured. A coupon code typed at checkout, or attributing the customer server-side at sign-up, both work without a cookie at all and are unaffected.
Which wins, a coupon code or a referral link?
You decide, but most programs let the coupon code win, because typing a partner’s code at checkout is a deliberate choice by the buyer. Write the rule into your partner terms so partners know it in advance.