Skip to content

Attribution

Affiliate marketing attribution: links, codes, cookie windows and what buyers say

Affiliate programs pay on tracked links and codes, but the sale an affiliate gets credit for isn't always one it caused. Here is how the tracking works, where it leaks and how to check it with your customers.

Yforms team, Product & growthPublished 7 min read

On this page

Affiliate marketing attribution is how you decide which affiliate gets paid for which order. Most programs credit a sale to the affiliate whose tracking link the buyer clicked last within a cookie window, or whose discount code was used at checkout. That rule is simple to run, but it pays for some sales affiliates didn't cause and misses some they did. This guide explains how links, codes and windows work, where credit leaks to coupon sites, and how to check each affiliate against what buyers say when you ask How did you hear about us?.

How affiliate tracking works

There are two ways an order gets tied to an affiliate, and most programs use both.

The two ways affiliate apps credit an order
MethodHow it worksWhat it misses
Tracking linkThe affiliate's link carries an ID. Your affiliate app stores it in a cookie or similar, and credits the affiliate if the visitor orders within the windowBuyers who come back on another device, clear cookies, or arrive without clicking
Discount codeA code tied to the affiliate is entered at checkout. Shopify records it on the orderBuyers who heard about you from the affiliate but didn't use the code

Codes are the more reliable of the two, because they sit on the order itself. Shopify shows which discount was used on every order, and you can report on it (Shopify Help Center (opens in a new tab)). Links depend on the browser keeping the ID long enough, which privacy settings increasingly prevent. Safari, for example, limits how long some cookies set by scripts can last (WebKit (opens in a new tab)).

When both are present and point to different affiliates, the app's own rules decide. Some give priority to the code, others to the most recent link. Check your app's settings. The answer changes who gets paid.

The cookie window, sometimes called the referral period, is how long after a click an order still counts for the affiliate. Common choices run from 7 to 90 days. Longer windows are more generous to affiliates and more attractive to recruit with. They also pay for more orders the affiliate had little to do with.

Most programs use last click: if a buyer clicks two affiliates' links, the later one gets the sale. That rewards whoever is closest to checkout. In practice, that is often not the blogger or creator who introduced the product, but a coupon or cashback site the buyer visited in the last minute before paying.

Choosing a cookie window
WindowGood forRisk
7 daysLow-price, impulse productsUnder-pays content partners whose readers think it over
30 daysMost storesA fair middle, but coupon sites still win last click
60 to 90 daysHigh-price products with long researchPays for orders driven by your own ads and emails weeks later

Coupon leakage and coupon-site affiliates

Coupon leakage is when a code meant for one audience spreads to people it wasn't for. A creator's code ends up on a coupon site. A browser extension finds it and applies it automatically. Now a buyer who came from your own Instagram ad, already had a full cart and was about to pay gets a discount, and the creator gets a commission.

You pay twice for that order: once in discount and once in commission, on a sale you'd have made anyway. Coupon and cashback sites that join your program as affiliates do the same thing on purpose. Some bring real new buyers. Many mostly catch shoppers who searched your brand + discount code at checkout.

  • Watch code usage by day. A creator's code that suddenly gets used far more than their audience size suggests has probably leaked.
  • Limit generous codes. Shopify lets you cap a discount's total uses and limit it to one use per customer, and apps can create unique codes in bulk.
  • Rotate public codes and retire any that appear on coupon sites.
  • Pay coupon sites less, or only on new customers, and say so in your program terms.
  • Give content partners priority over coupon sites when both touched an order within a short time, if your affiliate app supports it.

The same sale, claimed by everyone

Affiliate tracking runs separately from your ad platforms. A buyer who saw a Meta ad, read an affiliate's review, clicked a coupon site and then bought can be counted by Meta, by the affiliate app (for the coupon site) and by Shopify's last click (for whichever visit came last). Add up every source's claimed orders and you'll often get more than your real order count.

That doesn't make any one source wrong by its own rules. It means you can't add them together, and you can't judge the affiliate channel's real share from the affiliate dashboard alone. You need one source that counts each order once, from the buyer's point of view.

How to check affiliates with How did you hear about us

Ask every buyer How did you hear about us? on the Shopify Thank you page. Include options that match how affiliates actually reach people: A blog or review site, A YouTube review, A creator or influencer, A coupon or deal site. Add a short text box after review sites and creators asking which one. People who read a review on a specific site often remember the name. Our how did you hear about us survey guide covers wording and order.

Then compare, once a month, three numbers for each affiliate or affiliate type:

Illustrative example, not real data: a month of affiliate credit next to buyers' answers
Affiliate typeOrders credited by the appOrders where buyers named them
Review and content sites120150
Creators90160
Coupon and deal sites21025

Read the gaps in both directions. In this example, content sites and creators are named more often than they're credited, which is common: people read or watch, then come back later without the link. Coupon sites are credited far more often than buyers name them, because they sat at the last click. Few people say I heard about you on a coupon site. That pattern tells you to pay content partners more fairly and coupon sites less.

You can also check order by order. For orders an affiliate was credited for, look at what the buyer said. If most of a coupon site's credited orders came from buyers who said Instagram or a friend, it's catching sales, not making them. For creators specifically, our post on influencer marketing attribution goes deeper on codes and the sales they miss.

Yforms asks the question on your Thank you page and charts the answers by channel, so the right-hand column above is filled in for you. Written answers, such as the names of review sites, can be exported with the order number for the order-by-order check.

Setting up a program that pays for real influence

  1. Write the attribution rules into your terms. The window, what happens when a link and a code disagree, and whether coupon sites earn full commission.
  2. Give each partner their own link and code, and put usage limits on generous codes.
  3. Tag affiliate links with UTM parameters so Shopify's reports show them too. Our UTM parameters for Shopify guide has a naming scheme.
  4. Ask buyers every order and include affiliate-type options in the survey.
  5. Review monthly: credited orders, orders named by buyers and the overlap, per partner.
  6. Adjust commissions toward partners buyers actually name, and away from partners who only appear at the last click.

Commission based on buyers' answers alone would be hard to run, since not every buyer answers and answers can't be audited per order the way a code can. Keep tracking as the payment record. Use the answers to set rates, choose partners and spot leakage. If you also want to know whether the affiliate channel as a whole adds sales, an incrementality test is the strongest check.

Questions

What is a good affiliate cookie window?

30 days is common and works for most stores. Go shorter for cheap, impulse products and longer only if your buyers really take weeks to decide.

Should coupon sites be part of my affiliate program?

Only on terms that reflect what they do. Many mostly catch buyers already at checkout, so pay them a lower rate, pay only on new customers or exclude them.

Is a discount code or a tracking link more accurate?

A code is more reliable because it sits on the order, but it leaks and it misses buyers who don't use it. A link misses buyers who switch devices or clear cookies. Use both and check them with buyers' answers.

Can a post-purchase survey replace affiliate tracking?

No. Tracking is the record you pay commissions on. The survey tells you which partners buyers remember, which helps you set rates and spot leakage.

Start free on Shopify

Hear from every customer after they buy.

Yforms asks one short question on your thank-you page, when the order arrives and after use. Free for up to 200 orders a month, and every new store gets 14 days of Growth.

Keep reading