In short: affiliate tracking connects an order back to the partner who sent the shopper. A partner shares a tracked link. When a shopper taps it, the link records the click and saves a small marker in the shopper's browser. When that shopper orders within the attribution window, the store reads the marker and credits the partner. Discount codes, cookies and attribution rules all sit on top of that basic loop. This guide explains each piece in plain words, where tracking breaks, and how to test yours before you pay anyone.
Every affiliate and creator program runs on one promise: when a partner sends you a customer, the partner gets paid. Affiliate tracking is how you keep that promise, so you know who earned a commission and how much.
The basic loop: click, marker, order, credit
- 1. The partner shares a tracked link: Each partner gets a unique affiliate link. It might be a long store address with an ID on the end, or a short link that redirects to your store. Either way, the link says who sent the shopper.
- 2. The click is recorded: When a shopper taps the link, the tracking system logs the click (time, partner, landing page) and sends the shopper on to your store.
- 3. A marker is saved in the browser: Your store saves a marker, usually a first-party cookie or a value in browser storage, that says "this visitor came from partner X." Good setups also add it to the cart so it travels with the order.
- 4. The order is matched: When the shopper checks out, the system reads the marker, checks that the click is still inside the attribution window, and creates a commission for that partner.
- 5. Refunds adjust it: If the order is refunded, the commission should shrink or disappear. Programs that skip this step pay for sales they gave back.
Everything else in affiliate tracking (windows, codes, last click, server-side events) is a rule about one of those five steps.
What is an attribution window?
The attribution window, often called the cookie duration, is how long after a click an order still counts. If your window is 30 days and a shopper taps a creator's link on the 1st and buys on the 20th, the creator gets credit. If they buy on the 35th, nobody does.
Longer windows are friendlier to partners, especially creators whose audiences watch a video, think about it and come back later. Shorter windows cost you less for sales that would have happened anyway. Pick one, publish it in your program terms and don't change it quietly.
Why do browsers shorten some windows?
Browsers limit tracking, and that affects affiliate markers. WebKit, the engine behind Safari, explains in its March 2020 post on tracking prevention (checked October 19, 2026) that cookies set by scripts on the page already expire after seven days, a change made in February 2019, and that script-writable storage is deleted after seven days of Safari use without a visit to the site. In practice, a 60-day window can act like a shorter one for some Safari shoppers. Ad blockers, private windows that get closed, and cleared browsing data have the same effect.
That's why many programs also save the click on the cart or on their own server, and why you should test with the browsers your customers actually use.
Can discount codes track affiliate sales?
A creator's discount code (say, MAYA15) does two jobs in many programs. It gives the shopper a reason to buy today, and some systems also use the code itself to credit the creator, even when the shopper never tapped a link. That second job is called code-based or voucher attribution.
Code-based attribution catches sales links miss, like a podcast listener who types the code. It also has a well-known weak spot: codes leak. Once a code lands on a coupon site or a browser extension, shoppers who never saw the creator use it, and the creator gets paid for sales they didn't drive. Our guide to affiliate links vs discount codes covers the trade-off in detail.
Who gets credit when several partners touch a sale?
| Model | Who gets credit | Good for | Watch out for |
|---|---|---|---|
| Last click | The most recent partner link tapped before the order | Simple, easy to explain, the most common rule in affiliate programs | Undervalues the creator who first introduced the product |
| First click | The first partner link tapped in the window | Rewarding discovery | Pays partners whose shoppers were later convinced by someone else |
| Split or multi-touch | Credit shared between several partners | Programs where several creators often promote the same launch | Harder to explain, and partners can dispute the math |
| Code-based | The owner of the code used at checkout | Audio, podcasts and offline mentions | Leaked codes credit the wrong person |
Attribution also has to play fair with your other channels. If a shopper taps a creator's link, then clicks a Google ad and buys, your ad platform and your affiliate program may both claim the sale. Decide up front whether affiliate credit wins, loses or is shared, and compare totals in your own revenue attribution rather than adding every platform's numbers together.
What is server-side and first-party tracking?
Older affiliate networks relied on third-party cookies set by the network's own domain. Most browsers now block those. Modern setups use first-party tracking instead: the marker lives on your store's own domain, and the order is matched on your side or on the tracking provider's server when the order arrives. This is sturdier than a pixel that fires in the shopper's browser on the thank-you page, which ad blockers can stop.
No method is perfect. A shopper who taps a link on their phone and buys on a laptop leaves no shared marker unless they're signed in on both. Tell partners that plainly; it saves arguments later.
How do you test affiliate tracking before launch?
- Make a test partner and a tracked link for them.
- Open the link in a fresh browser window, add a product and check out with a cheap item or a 100% test discount.
- Confirm the order shows up credited to the test partner, with the commission you expect.
- Refund the order and confirm the commission drops.
- Repeat on Safari on an iPhone, since that is where many creator audiences shop.
- Try the discount code with no click, so you know exactly what your system does in that case.
- Write down what you found and share the rules with partners before they post.
How Spark! tracks creator sales
Spark! is Chargezen's creator and affiliate platform. It's software for running your own program on your Shopify store, not an affiliate network. Its tracking follows one rule, the click rule, and it says so openly:
- Tracked links: Each creator gets tracked links, which can use your own short-link domain, QR codes and UTM parameters. See tracking links.
- The click rule: An order is credited when the shopper tapped the creator's link and then ordered in the same browser within your attribution window, which is 90 days unless you change it. If they tapped more than one creator's link, the most recent tap wins. The full rule is in how commissions are credited.
- Codes are a shopper perk: Spark! can set up discount codes in your Shopify store, but a code typed with no click before it earns no commission. That keeps leaked codes from paying the wrong person. See discount codes.
- Renewals count: When a referred shopper subscribes, the creator earns on their renewal orders too. See commissions on subscription renewals.
- Refunds adjust commissions: Refunds lower the commission on their own, and money already paid is taken back from the next payout. See refunds and clawbacks.
Spark! is $199 a month or $1,990 a year, with no fee on creator sales or payouts. Before launch, run the steps in testing your tracking.
Glossary: last-click attribution, voucher attribution, affiliate link, cookie duration, revenue attribution and UTM. Read next: affiliate links vs discount codes, influencer marketing ROI and paying influencers commission. Setting up a program? See how to start an affiliate program on Shopify and affiliate commission rates.
Frequently asked questions
How does affiliate tracking work?
A partner shares a unique link. When a shopper taps it, the click is recorded and a marker is saved in the shopper's browser. If the shopper orders within the attribution window, the store reads the marker and credits the partner with a commission. Refunds should lower or cancel that commission.
What is a good affiliate cookie duration?
There's no single right affiliate cookie duration. Longer windows suit products people think about before buying and creators whose audiences come back later; shorter windows suit impulse buys. Pick a window you can defend, publish it in your program terms, and remember that Safari and ad blockers can shorten it in practice.
Can affiliate sales be tracked with a discount code alone?
Some programs credit the code's owner whenever the code is used, with or without a click. It catches podcast and offline mentions but pays out on leaked codes. Spark! credits the creator whose link was tapped and treats the code as a discount for the shopper.
Written by
Mason Reed
Creator Economy Writer, Chargezen
Mason Reed covers the technology transforming the creator economy and influencer marketing. He explores how AI is helping brands discover creators, manage partnerships, measure campaign performance, and turn audience engagement into revenue. His work examines affiliate platforms, creator monetization, campaign automation, and the emerging tools connecting brands, influencers, and their audiences.
