How to Track Which Affiliate Drove Each
WooCommerce Order (Complete Attribution Guide)
Attribution is the mechanism that connects each order to the affiliate who drove it. When it works correctly, commissions are fair and your program data is reliable. When it breaks or is misunderstood, you pay the wrong affiliates, miss attribution on real referrals, and make program decisions based on inaccurate data. This guide explains exactly how attribution works in WooCommerce — and how to verify it is working correctly for every order type.
Updated 2026
Attribution Deep Dive

Every affiliate commission starts with the same question: which affiliate drove this order? The answer is not always obvious. A customer might click an affiliate link on Monday, visit your store directly on Wednesday, and complete their purchase on Friday using the affiliate’s coupon code. Or they might click three different affiliates’ links over two weeks before buying. Or they might arrive from a shared coupon code that you cannot confirm was only used by its intended affiliate’s audience.
Attribution is the set of rules that resolve these ambiguities. A well-designed attribution system is transparent — affiliates understand how their referrals are credited, you understand why each order is attributed the way it is, and disputes are rare because the rules are clear and consistently applied. A poorly configured or misunderstood attribution system creates constant friction: underpaid affiliates, commission disputes, and program data that does not reflect what is actually happening.
This guide covers how attribution works in WooCommerce affiliate programs in complete technical detail — the cookie tracking mechanism, coupon attribution, the priority rules when multiple attribution signals exist, how to trace any order’s attribution path, and what to do when attribution fails. The examples use Affiliate Engine, a WooCommerce affiliate tracking and attribution plugin, but the underlying mechanics apply to how WooCommerce affiliate tracking works broadly.
How cookie-based attribution works: the full technical lifecycle
Cookie-based attribution is the primary tracking mechanism for affiliate referral links. Understanding the complete lifecycle — from the moment a visitor clicks an affiliate link to the moment a commission record is created — makes it possible to diagnose attribution problems when they occur and to explain to affiliates exactly how their referrals are tracked.
The affiliate shares a URL with a tracking parameter appended — typically something like yourstore.com/?ref=affiliate123. The parameter name and the affiliate’s identifier value are what carry the attribution signal. The moment this URL is requested, the tracking mechanism activates.
When the page loads, the plugin reads the tracking parameter from the URL and writes a cookie to the visitor’s browser. The cookie stores the affiliate’s identifier and an expiry timestamp set to [current time + cookie lifetime]. A visit record is also logged in the Visits tab at this moment, recording the affiliate, the landing page, and the timestamp. If AJAX cookie setting is enabled, this write happens via JavaScript after page load — which preserves tracking on cached pages.
The affiliate cookie persists in the browser across the entire session and across future visits until it expires. The visitor can close the browser, return the next day, or navigate directly to the store — as long as the cookie is still valid and has not been overwritten by a newer affiliate click, the original affiliate attribution is preserved. The plugin reads the cookie at checkout.
When the WooCommerce order completion hook fires (triggered by payment success), the plugin reads the affiliate cookie from the buyer’s browser, reads the order value, calculates the commission based on the applicable rate rules, and creates a referral record in the Referrals tab. The referral record contains the order ID, the affiliate ID, the attributed revenue, the commission amount, and the attribution method (cookie). The commission status is set to pending.
The referral record sits in pending status for the configured hold period. Once the hold period expires without a refund, the commission status automatically moves to approved and is added to the affiliate’s payable balance. If the order is refunded during the hold period, the referral is reversed automatically. After approval, the commission is available for payout at the next processing date.
How coupon-based attribution works
Coupon attribution is a parallel attribution mechanism that operates independently of the cookie. When an affiliate coupon code is applied at checkout, the plugin reads the coupon code, looks up which affiliate account is linked to that coupon, and attributes the order to that affiliate — whether or not a tracking cookie is present in the buyer’s browser.

Coupon attribution is what makes WooCommerce affiliate programs trackable on social media — the primary channel where affiliate link tracking fails. When a creator shares their coupon code in an Instagram post, TikTok video, or newsletter, their audience arrives at your store without a tracking cookie because they typed the URL directly or found the store through search. The coupon code at checkout is the only attribution signal available, and it is sufficient to credit the referring affiliate correctly.
Many affiliate program operators think of coupon tracking as a backup for when cookie tracking fails. This framing understates coupon attribution’s importance. In 2026, a substantial proportion of affiliate-driven traffic arrives through channels where cookies are either blocked, cleared, or never set — mobile social media apps with in-app browsers, direct URL entry after seeing a post, email newsletters with no tracking link. For programs where affiliates promote on social media, coupon attribution is often capturing the majority of real referrals. Disabling or ignoring coupon attribution significantly undercounts the channel’s actual contribution.
Attribution priority rules: when cookie and coupon both exist
The most common attribution complexity occurs when both a tracking cookie and a coupon code are present at checkout. A visitor clicked an affiliate link last week (setting a cookie for Affiliate A) and today at checkout they apply a coupon code belonging to Affiliate B. Both attribution signals exist simultaneously — which affiliate gets the commission?
The coupon-overrides-cookie rule deserves explanation because it can seem counterintuitive. When a buyer has a cookie from Affiliate A but applies Affiliate B’s coupon code, the coupon is treated as the more reliable and intentional attribution signal. The logic is that the buyer specifically chose to use Affiliate B’s code at checkout — an active choice — whereas the cookie from Affiliate A may have been set from a casual visit weeks earlier. The coupon represents the affiliate relationship the buyer intended to honor.
This priority rule also protects against a known exploit: if cookies overrode coupons, an affiliate could inflate their own commission count by getting their referral cookie set on a buyer who then uses a different affiliate’s code. Coupon priority closes this loophole cleanly.
How to find the attribution source for any specific order
When an affiliate contacts you about a specific order — “why was I not credited for order #1284?” or “I can see a sale came through but I don’t know which one” — you need to be able to trace the attribution path for that specific order within a few minutes. There are two places to look.
Navigate to the Referrals tab in the Affiliate Engine admin dashboard. Search or filter by order ID. If a referral record exists for that order, you will see the affiliate it is attributed to, the commission amount, the attribution method (cookie or coupon), and the current commission status. The presence of a referral record confirms attribution succeeded. The absence of a referral record means no attribution signal was present at checkout — the order was not linked to any affiliate.
Navigate to WooCommerce → Orders → find the specific order. In the order detail view, look in the Order Notes section at the bottom of the page. Affiliate Engine (and most WordPress affiliate plugins) writes an order note when a commission is created, recording the affiliate name or ID and the commission amount. This note is visible in the WooCommerce order and can be cross-referenced against the Referrals tab. If no affiliate note is present, no attribution was recorded for this order.
If an affiliate claims they drove a specific order but the Referrals tab shows no commission for that order, check the Visits tab filtered to that affiliate. This shows you whether a click from that affiliate’s link reached your store around the time of the order. A visit record confirms the affiliate link was clicked; if the order was placed after that visit but no commission exists, the most common cause is that the cookie expired between the click and the purchase — or the buyer was logged in as a different account that matched the self-referral check.
Why attribution fails: the complete diagnostic guide
Attribution failures fall into distinct categories. Each category has a specific cause and a specific fix. Knowing which category applies to a given failure makes diagnosis fast and resolution straightforward.
Edge cases in attribution: the scenarios that need explicit rules
When a buyer clicks Affiliate A’s link on Monday and then Affiliate B’s link on Wednesday before buying on Friday, the last-click model — used by most WooCommerce affiliate plugins — attributes the sale to Affiliate B. The most recent affiliate cookie overwrites the previous one. This is consistent with how most affiliate programs in the industry work, but it is worth documenting in your affiliate terms so that affiliates understand the model. First-click models (which credit the first affiliate) exist but are less common and create different incentive structures.
An affiliate’s personal coupon code may spread beyond their intended audience — posted in a deal-sharing forum, included in a coupon aggregator site, or passed between friends. Orders placed using a coupon from these secondary sources are attributed to the affiliate who owns the code. This is intentional: the affiliate’s code drove the order regardless of how it spread. However, if the code is being used at scale by unintended parties, you may want to generate a new unique code for the affiliate and disable the old one to prevent ongoing unverifiable attribution.
When an existing customer who was previously referred by an affiliate makes a repeat purchase, attribution depends on whether they have a valid affiliate cookie or use the affiliate’s coupon. If neither is present, the repeat purchase is not attributed to the affiliate — it is treated as a direct purchase. This is the standard model. Some programs configure lifetime commissions for repeat purchases from referred customers, which requires storing the original referring affiliate on the customer’s account record — a more complex configuration that goes beyond cookie-based tracking.
Attribution verification checklist
Attribution is the foundation that every other part of your affiliate program rests on. When it is working correctly and you understand why, you can answer affiliate questions confidently, diagnose problems quickly, and trust that your program data reflects reality. When it is misconfigured or misunderstood, seemingly unexplained commission variances erode trust with affiliates and make program management guesswork.
Affiliate Engine’s WooCommerce affiliate attribution and order tracking plugin implements the cookie-and-coupon dual attribution model described in this guide, with coupon-priority rules, AJAX cookie setting for caching compatibility, per-order attribution records in the Referrals tab, visit history in the Visits tab, and WooCommerce order note logging that makes every attribution decision transparent and auditable.
Know exactly which affiliate drove every order — with transparent, auditable attribution records
Affiliate Engine implements dual cookie-and-coupon attribution with coupon-priority rules, AJAX tracking for caching compatibility, per-order referral records, visit history, and WooCommerce order note logging for full transparency.

About time! coupon rules that actually make sense.
Hey! Just wanted to say the hold period feature is genius. i had a couple refunds early on, and it auto reversed the payouts no manual fixes or headaches. huge time saver!
Saved me so many chargeback headaches!