Affiliate Marketing

Affiliate Tracking Explained: Links, Cookies and Click IDs

Every commission you earn depends on one technical question: did the merchant's system recognize that the customer came from you? If it did not, it does not matter how good your content was or how…

Every commission you earn depends on one technical question: did the merchant's system recognize that the customer came from you? If it did not, it does not matter how good your content was or how much the reader trusted you. You will not be paid.

Most beginners treat affiliate tracking as a black box. They paste a link, hope for the best and accept whatever the dashboard reports. Professionals understand how tracking works, where it breaks and which methods are most reliable. You do not need to be a developer to follow this guide, but you do need to understand tracking well enough to ask the right questions and notice when something is wrong.

What Affiliate Tracking Does

Affiliate tracking has three jobs:

  1. Record the referral. When someone clicks your link or uses your code, the system notes that you sent them.
  2. Remember it. Because many people buy later, the system must keep that record for the length of the attribution window.
  3. Match the conversion. When the person buys or signs up, the system connects the conversion to your referral and credits you.

Each job can fail in different ways. A link can drop your identifier. A cookie can be deleted. A conversion can happen on a different device. Understanding each method helps you choose programs that track well and diagnose problems when your numbers look wrong.

An affiliate link is an ordinary URL with extra information attached. A tracking link usually contains some combination of:

  • An affiliate identifier: the unique ID assigned to you.
  • A program or offer identifier: which merchant or product the link points to.
  • A destination URL: the page the visitor should land on, ideally a specific product page rather than the home page.
  • Sub-IDs: optional labels you add to record where the click came from, such as a specific article, email or button.

Here is a simplified, illustrative example:

https://track.example-network.com/click?aff=12345&offer=678&sub1=web-grinder-table&url=https%3A%2F%2Fshop.example.com%2Fgrinder-x

When a visitor clicks, the link usually passes through a redirect: a quick hop through the network's or merchant's tracking server, which records the click and forwards the visitor to the destination. Some modern setups skip the visible redirect and record the click directly on the merchant's site using a parameter in the URL.

Notice that the destination URL is encoded: characters like : and / are replaced with codes such as %3A and %2F. If encoding goes wrong, the redirect can fail or drop parameters, so encoding errors are a common cause of broken tracking.

Sub-IDs: The Most Underused Tracking Tool

Sub-IDs deserve special attention. Without them, you know that a program produced sales but not which page, email or button produced them. With them, you can calculate earnings per click for each placement and make real decisions about what to write, update or remove.

A simple, consistent scheme might encode channel, page and placement, for example web-espgrind-table for the comparison table on an espresso grinder guide. Use only letters, numbers and hyphens, keep within each program's length limit, and never put personal data such as email addresses in a sub-ID.

The classic way to remember a click is a cookie: a small text file stored in the visitor's browser. When the visitor clicks your link, the tracking system sets a cookie recording your affiliate ID and the time of the click. When the visitor buys later, the merchant's checkout reads the cookie and credits you.

The cookie duration, also called the cookie window, referral period or attribution window, is how long that cookie stays valid. With a 30-day cookie, a purchase on day 29 is credited and a purchase on day 31 is not.

First-party and third-party cookies

  • Third-party cookies are set by a domain other than the one the visitor is viewing, such as a network's tracking domain during a redirect. Browsers increasingly restrict or block these for privacy reasons, and some limit how long certain cookies last.
  • First-party cookies are set by the merchant's own domain after the visitor lands. They are more resilient, which is why most modern affiliate tracking relies on them, often by passing a click identifier in the URL and storing it on the merchant's side.

Why cookies fail

Cookies also fail for everyday reasons that have nothing to do with browser policy:

  • The visitor clears cookies or browses in private mode.
  • The visitor clicks on a phone and buys later on a laptop.
  • The visitor clicks inside a social app's built-in browser and buys in their normal browser.
  • Ad blockers or privacy extensions strip tracking parameters or block tracking domains.
  • The visitor declines tracking on a consent banner, and the merchant honors that choice.

Every one of these failures means a sale you influenced goes uncredited. Estimates of lost attribution vary widely by audience and device mix. The principle is what matters: cookie-only tracking undercounts, and the undercount grows as privacy protections strengthen.

Server-to-Server Tracking and Click IDs

To reduce reliance on browser cookies, many programs use server-to-server tracking, also called S2S, postback or API-based tracking. It works like this:

  1. When a visitor clicks your link, the tracking system generates a unique click ID.
  2. The click ID is passed to the merchant's site in the URL.
  3. The merchant stores the click ID with the visitor's session or account.
  4. When the visitor converts, the merchant's server sends a message, called a postback, directly to the network's server, reporting the click ID and the sale.
  5. The network matches the click ID to your click and credits you.

Because the record lives on servers rather than only in the visitor's browser, it survives many of the problems that kill cookies. It is also generally more accurate and harder to tamper with. You will rarely set this up yourself as a publisher, but you should ask whether a program uses it. Programs with server-side tracking tend to report more complete conversions.

Other Ways Affiliate Sales Are Tracked

Links and cookies are not the only methods. Depending on the vertical and channel, you may encounter:

  • Coupon or promo codes. A unique code is tied to you, and you are credited whenever a customer uses it, with or without a click. Codes work across devices and suit creators, podcasts and offline promotion. They leak easily to coupon sites and can conflict with link-based attribution.
  • Account-level or lifetime attribution. Some software and subscription programs tie the customer's account to you permanently, so you earn on renewals or future purchases.
  • Phone call tracking. In insurance, legal and home services, a unique tracking number credits calls that last longer than a minimum duration.
  • Lead form submissions. Pay-per-lead offers credit you when a qualifying form is completed, though payment may depend on later validation.
  • App installs and in-app events. Mobile offers use specialized attribution systems that match a referral to an install and later actions.
  • Dedicated landing pages or vanity URLs. Some creators get their own landing page, so any traffic arriving there is credited to them.

Each method has its own blind spots, so always ask how a program handles edge cases.

Affiliate Tracking by Channel

ChannelMain tracking methodCommon failure pointsBest mitigations
Website contentLinks with cookies or click IDsCross-device journeys, blockers, short cookiesSub-IDs, server-side programs, longer windows
EmailLinks, often via your own siteMail client link scanners, device switchingLink to your own pages first; unique sub-IDs per email
Long-form videoDescription links, codesViewers search directly instead of clickingUnique codes, vanity URLs, companion web pages
Short-form video and socialProfile links, storefronts, codesIn-app browsers, limited linksPlatform commerce tools, codes, link pages
PodcastsCodes, vanity URLsListeners forget codesRepeat codes; memorable URLs; show notes
Paid adsClick IDs and postbacksPostback misconfiguration, delaysTest postbacks; reconcile reports
Phone-based offersTracking numbersCalls below minimum durationClear calls to action; prequalify callers
Offline mentionsCodesCode leakage to coupon sitesCode protection agreements

How Privacy Rules Affect Affiliate Tracking

Privacy laws in many regions require websites to get consent before setting non-essential cookies, to explain what data is collected and to honor opt-outs. For affiliates this has three effects:

  • On your own site, analytics, ad pixels and tracking scripts may need a consent mechanism and a clear privacy notice. Get local advice if you are unsure.
  • On the merchant's side, visitors who decline tracking may not be attributed, so you see fewer reported conversions for the same real influence.
  • On data sharing, programs share less customer-level data. Expect aggregate reports rather than details about individual buyers.

The long-term trend favors first-party relationships: audiences who know you, subscribe to you and act on your recommendations knowingly. Codes, logged-in experiences and owned email lists all grow more valuable as passive tracking weakens.

Tip: When two programs offer similar products and rates, choose the one with server-side tracking and a clear answer about how codes and links interact. Better tracking is effectively a pay rise.

How to Test Affiliate Tracking

Do not assume your links work. Test them when you join a program, change how your site handles links or notice a sudden drop in reported conversions.

  1. Click your own link in a clean browser session and confirm it lands on the intended page with sub-IDs intact after every redirect.
  2. Confirm the click registers in the program dashboard, usually within minutes to a few hours.
  3. Check whether self-purchases are allowed. If they are, a small test purchase is the most reliable test. If not, ask your affiliate manager to confirm tracking or provide a test mechanism.
  4. Test on mobile, including inside the in-app browsers of the social platforms you use.
  5. Scan for broken or outdated links regularly. A link that lands on an error page or the home page loses sales and trust.
  6. Compare your own click data with the program's. If your analytics show 500 outbound clicks and the program reports 200, find out why. Some difference is normal because of bots, duplicate clicks and blockers, but a large or growing gap needs investigation.

Questions to Ask Any Program About Tracking

Before you invest time promoting a program, you should be able to answer these:

  • What is the attribution window, and does it differ by product or action?
  • Which attribution model is used, and can coupon or cashback partners override content partners?
  • Is tracking cookie-based, server-side or both?
  • Are coupon codes attributed to affiliates, and what happens when a link and a code conflict?
  • Is there lifetime or account-level attribution for repeat purchases?
  • Are commissions paid on new customers only, or on returning ones too?
  • Can you use sub-IDs, and do reports break down by them?
  • Is there a way to test tracking?

If a program cannot answer clearly, or its affiliate manager never replies, treat that as information about how the rest of the relationship will go.

Example: Finding a Tracking Leak

Here is an illustrative example with invented figures. A publisher notices that one program reports 40% fewer clicks than their own outbound click tracking shows, while other programs differ by only 10% to 15%.

They click their own links in a clean browser and everything works on desktop. On mobile, inside a social app's in-app browser, the redirect lands on the merchant's home page and the sub-ID is missing. Their recent traffic from social has grown sharply, so a larger share of clicks now passes through that broken path.

They report the issue to the affiliate manager with screenshots, switch social traffic to a link page on their own site that opens the merchant in the device's main browser, and add a coupon code for social followers as a backup. The following month the gap narrows to 12%, and reported sales from social rise. Nothing about the content changed; the fix was entirely in tracking.

Common Mistakes

  • Assuming links work without testing them on mobile and in in-app browsers.
  • Not using sub-IDs, so you cannot tell which pages and placements earn.
  • Including personal data, such as email addresses, in tracking parameters.
  • Ignoring the gap between your click counts and the program's.
  • Choosing programs on commission rate alone, without asking how they track.
  • Letting coupon codes leak to coupon sites, where they capture sales you did not influence.
  • Breaking links with bad URL encoding when building deep links by hand.

Frequently Asked Questions

How does affiliate tracking work?

When someone clicks an affiliate link, the tracking system records your ID and stores it in a browser cookie, on the merchant's servers using a click ID, or both. When the person converts within the attribution window, the system matches the conversion to your click and credits you.

Are cookies still used for affiliate tracking?

Yes, but mostly first-party cookies set by the merchant's own domain, often combined with click IDs and server-side tracking. Third-party cookies are increasingly blocked by browsers.

What is a click ID?

A click ID is a unique identifier generated for each click on an affiliate link. It is passed to the merchant and returned with the conversion, so the network can match the sale to the exact click without relying only on cookies.

Why do my clicks not match the network's report?

Some difference is normal, caused by bots, duplicate clicks, ad blockers and redirects that fail. A large or growing gap usually points to a technical problem, such as stripped parameters in in-app browsers or broken links.

Do coupon codes count as affiliate tracking?

Yes. A unique code credits you whenever a customer uses it, even without a click. Check how the program handles conflicts between a code and someone else's link.

Can affiliate tracking work across devices?

Only partly. If the customer logs in on both devices, the merchant may connect the journey. Otherwise a click on one device and a purchase on another usually goes uncredited.

For more on how browsers are restricting cross-site tracking, see MDN's guide to third-party cookies.


Good tracking turns guesswork into decisions. To check that every sub-ID and parameter survives your links, paste them into the free URL Parser and inspect each part.