What is a Cookie?
A cookie is a small piece of data stored in a visitor's browser. When someone clicks an affiliate link, we save the affiliate's referral code in a cookie so we can remember who referred them.
Think of it like a digital receipt that says "this visitor came from Affiliate X." When they eventually make a purchase—even days or weeks later—we check the cookie and credit the sale to the right affiliate.
How Tracking Works
Here's what happens when someone clicks an affiliate link:
- Click — A visitor clicks an affiliate's link (e.g.,
yoursite.com?ref=john123) - Cookie saved — We store "john123" in their browser
- Visitor browses — They might leave, come back later, or browse multiple pages
- Purchase — When they buy, we check the cookie and credit "john123"
This means affiliates get credit even if visitors don't buy immediately. The cookie persists across sessions, so a visitor who clicks today and buys next week is still attributed correctly.
Cookie Duration
Cookie duration is how long the cookie stays active. You can configure this per program:
- 5–15 days — For impulse purchases or fast-moving products
- 30 days — The standard for most businesses (recommended)
- 60–90 days — For higher-consideration purchases
- 180–365 days — For enterprise/B2B with long sales cycles
Choose a duration that matches your typical sales cycle. If customers usually take 2 weeks to decide, 30 days gives you a comfortable buffer.
Browser Limits (180 Days)
Even though you can set cookie duration up to 365 days, most browsers cap cookies at ~180 days.
This is due to privacy features like Safari's Intelligent Tracking Prevention (ITP) and similar policies in other browsers. They automatically delete cookies older than ~180 days to protect user privacy.
What this means: If you set a 365-day cookie duration but a visitor doesn't return for 200 days, the cookie may have been deleted by their browser. The affiliate won't get credit for that sale.
For most businesses, this isn't a problem—customers rarely take 6+ months to purchase. But if you have very long sales cycles, be aware of this limitation.
When Does the Cookie Reset?
The cookie only resets when a visitor clicks a new affiliate link. This is called last-click attribution.
- New referral click: If a visitor clicks
?ref=affiliate2, the old cookie is overwritten. The new affiliate gets credit. - No new click: If a visitor returns without a
?ref=parameter, the existing cookie is preserved. The original affiliate keeps credit.
Example timeline:
Day 1: User clicks ?ref=affiliate1 → cookie set for affiliate1
Day 5: User returns directly (no ref) → cookie unchanged, still affiliate1
Day 10: User clicks ?ref=affiliate2 → cookie overwritten, now affiliate2
Day 15: User purchases → affiliate2 earns commission
Learn more: Read Why Last-Click Attribution to understand why this model is fairest for affiliates.
