How Affiliate Links and Cookies Work: From Click to Commission (2026)

An affiliate link looks like an ordinary web address, but it carries one extra piece of information: who sent the visitor. That single detail is what lets a company pay you when someone you referred buys. Understanding how it travels from the click to the sale helps you choose better programs, avoid lost commissions and set realistic expectations.

This guide explains what is inside an affiliate link, how cookies and other methods record the referral, how cookie windows and "last click" work, and the common reasons a sale is not credited.

Every affiliate link contains an identifier that belongs to you. Depending on the program, it may appear as a parameter such as ?ref=yourname, ?aff=12345 or ?fp_ref=abc, or it may be hidden inside a link on the network's own domain that redirects to the merchant. Some links also include a product or offer ID and optional tracking labels you add yourself, called sub-IDs.

PartExamplePurpose
Destinationmerchant.com/productThe page the visitor lands on
Affiliate ID?ref=yournameIdentifies you so the sale can be credited
Offer or campaign ID&offer=22Tells a network which program the click belongs to
Sub-ID (optional)&sub1=email_day3Your own label for reporting

You get your links from the program's affiliate dashboard. Never edit the affiliate ID part by hand, and test every link before you publish it.

What Happens When Someone Clicks

  1. The click. A reader clicks your link in a blog post, video description or email.
  2. The redirect. The link usually passes through the merchant's or network's tracking server, which records the click and your ID.
  3. The record. The tracking system stores the referral, most often in a cookie in the visitor's browser, sometimes also on its own servers.
  4. The landing. The visitor arrives at the merchant's page, usually within a second.
  5. The purchase. If the visitor buys within the allowed time, the checkout reads the stored referral.
  6. The credit. The sale appears in your dashboard, often as pending until the refund period passes.

A cookie is a small text file a website stores in the visitor's browser. An affiliate cookie holds information such as your affiliate ID and the time of the click. When the visitor returns to buy, the merchant's site reads the cookie and knows who referred them. The cookie does not contain the visitor's personal details, and it does not follow them to unrelated sites.

Most affiliate tracking now relies on first-party cookies, set by the merchant's own domain, because browsers such as Safari and Firefox restrict third-party cookies by default. Many programs also combine cookies with server-side records, account matching or coupon codes so that a referral survives even when a cookie is lost.

Tablet showing a search page beside a white keyboard

The cookie window, also called the cookie duration or attribution window, is how long after a click a purchase still counts as yours. It varies enormously between programs:

ProgramWindow
Amazon Associates24 hours to add items to the cart; carted items count if ordered before the cart expires (usually 90 days)
Leadpages90 days (per its affiliate page)
AWeber90 days
Kinsta60 days, last touch
ClickBank60 days by default
Elementor45 days

A longer window matters most for considered purchases such as software, courses and hosting, where people compare options for days or weeks before buying. For impulse purchases, a short window matters less.

Last Click, First Click and Lifetime Attribution

When a visitor clicks links from two different affiliates before buying, the program needs a rule to decide who gets paid.

  • Last click: the most recent affiliate link clicked before purchase wins. This is the most common rule. Amazon, for example, closes your window when the customer re-enters through another Associate's link.
  • First click: the first affiliate to refer the visitor keeps the credit for the window. Less common.
  • Lifetime or account-based: once a customer is tied to you, future purchases or renewals are credited to you. This is how many recurring software programs work.

Because last click is common, being the most helpful page a buyer sees just before deciding is often worth more than being the first.

Why Commissions Go Missing

  • The purchase happened outside the window. The buyer came back after the cookie expired.
  • Another affiliate's link was clicked later. Under last click, they win.
  • Cookies were cleared or blocked, or the visitor switched devices, for example clicking on a phone and buying on a laptop.
  • The link was broken or edited, so your ID never reached the merchant.
  • A coupon code overrode the link. Some programs credit the affiliate whose coupon was used at checkout.
  • The order was refunded or cancelled during the validation period.
  • The order did not qualify, for example personal purchases on programs that exclude them.

You cannot prevent every lost referral, but testing links, choosing programs with sensible windows and making your page the last helpful stop before purchase all reduce the losses.

Beyond Cookies: Other Ways Sales Are Tracked

  • Server-side and postback tracking: the merchant's server reports conversions directly to the network or your tracker. See postback URLs explained.
  • Coupon codes: a code unique to you credits the sale even without a click.
  • Account linking: some platforms tie a customer to you when they sign up, so later payments are credited regardless of cookies.
  • Referral fields: some checkouts let customers enter the referrer's code manually.
Laptop showing code beside a smartphone
  1. Open the link in a private browser window.
  2. Confirm you land on the right page and the URL or network shows your ID.
  3. Check that the click appears in your affiliate dashboard, if it reports clicks.
  4. Add a sub-ID so you can see which placement converts. Our guide to affiliate link tracking shows how.

Our #1 Recommendation for Making Money Online in 2026

This beginner-friendly system is simple to set up and takes less than 30 minutes per day.

Check Out Our #1 Pick

However a link is tracked, readers should know you may earn a commission. The FTC's guidance says the disclosure should be clear and placed close to the recommendation, and that the words "affiliate link" alone are not enough; it gives example wording such as "I get commissions for purchases made through links in this post." Similar rules apply in the UK, EU and elsewhere. Cleaner, branded redirect links are fine where programs allow them; see link cloaking explained.

Frequently Asked Questions

How Do Affiliate Links Track Sales?

The link carries your affiliate ID. When clicked, the program records the referral, usually in a cookie and often on its servers too, and credits you if the visitor buys within the cookie window.

How Long Do Affiliate Cookies Last?

It depends on the program. Amazon's window is 24 hours for adding items to the cart; many software programs use 30 to 90 days.

Do I Get Paid If Someone Buys a Different Product?

Often, yes. Many programs pay on any qualifying purchase made during the window, not just the product you linked. Check each program's terms.

What Happens If Two Affiliates Refer the Same Buyer?

Most programs use last click, so the affiliate whose link was clicked most recently before purchase is credited.

Can Affiliate Tracking Work Without Cookies?

Yes. Server-side postbacks, coupon codes and account-based attribution can credit sales without relying on browser cookies.