On this page
What this issue is
When someone clicks a partner's link (for example ?ref=anna), your affiliate tool saves a small file in their browser called a cookie. It holds the partner or click ID. On the order or lead confirmation, the tool reads that cookie and credits the partner.
This issue has two forms. In the first, the cookie is never set: the script is blocked, the parameter is stripped, or consent rules hold it back. In the second, the cookie is set on the wrong domain: for example on www.example.com while checkout runs on shop.example.com or checkout.example-pay.com, so the checkout cannot see it.
Why it costs you leads or sales
Sales still happen, but the partner who earned them gets nothing. Partners notice missing commissions fast, stop promoting you or leave the programme. You also lose clean data on which partners really drive revenue, so budget decisions get worse.
- Partner link clickVisitor lands with ?ref=anna
- Cookie savedSet on www.example.com only
- CheckoutRuns on shop.example.com, cookie not visible
- CommissionOrder has no partner attached
The cookie is set on the wrong domain, so the confirmation page cannot read it.
Example: 100 orders came from partner links. With the cookie on the wrong domain, far fewer are credited.
How to check if your site has it
Open a private window
Use a fresh incognito or private window so old cookies do not confuse the result.
Visit with a referral link
Load your site using a real partner link or one with the parameter your tool uses, such as ?ref=test or ?via=test. Accept cookies if a banner appears.
Open DevTools storage
In Chrome press F12, go to Application, then Cookies. In Firefox go to Storage, then Cookies. Look for the cookie your tool sets (for example rewardful.referral, a PartnerStack partner key, or an Impact irclickid cookie; names vary by tool, so check its docs).
Read the Domain column
The domain should be your root domain (shown as .example.com) if checkout is on a subdomain. If it shows only www.example.com, or a third-party domain, a subdomain checkout will not see it.
Walk to checkout
Move to the checkout or thank-you page and check the cookie is still listed for that hostname. Also check Path is / and Expires is not a session value if you promise a long window.
| Column | Healthy value | Problem value |
|---|---|---|
| Domain | .example.com (root domain) | Only www.example.com, or a different domain than checkout |
| Path | / | /landing or another narrow path |
| Expires | Matches your attribution window (for example 30 to 90 days) | Session, or a few minutes |
| SameSite | Lax | None without Secure, or Strict on cross-site flows |
| Secure | Yes on HTTPS | Missing on an HTTPS site |
If the affiliate script is blocked or does not run, no cookie is written.
How to fix it
Start with why the cookie is missing or misplaced. The most common causes are: the tracking script is not loaded on the landing page, a consent banner blocks it until the visitor agrees, a redirect drops the referral parameter, or the tool's cookie domain is set to a single hostname instead of your root domain.
Load the script on every landing page
Make sure the affiliate script is on every page a partner can link to, not only the home page. Place it site-wide in the head or through your tag manager.
Set the cookie domain to your root domain
In your affiliate tool's settings, enter your root domain (example.com) as the tracking or cookie domain, so the cookie covers www, shop and other subdomains. Where the tool has a config option, use it.
Use first-party cookies
Prefer the tool's first-party option, where the cookie is written by a script on your own domain. Third-party cookies are often blocked by browsers.
Keep the referral parameter through redirects
If a redirect removes ?ref= before the script runs, the cookie is never written. Make the redirect pass the query string through.
Sort out consent
If your consent banner holds back affiliate scripts, classify them correctly in the banner settings and load them after consent. Do not bypass the choice visitors make.
Match cross-domain checkouts
If checkout is on a separate domain such as a hosted payment page, use your tool's cross-domain or link-decoration feature, or pass the partner ID in the checkout URL or order metadata. A cookie on one domain cannot be read on another.
Check the plugin settings
If you use an affiliate plugin, open its settings and look for a cookie domain or tracking domain field. Enter your root domain. Exclude the landing pages from any caching plugin rules that strip query strings.
Place the script site-wide
If you paste the tracking snippet manually, add it in the header through your theme's header settings or a header-scripts plugin, not on a single page.
Add the script in the theme
Install the affiliate app, or add the script to theme.liquid before the closing head tag in Online Store, Themes, Edit code.
Mind the checkout domain
Shopify checkout may run on a different hostname than your storefront. Pass the partner ID through cart attributes or the app's own integration so the order carries it.
Fire the affiliate tag on All Pages
Create the tag with the trigger All Pages (or the pages partners link to), not only a thank-you page.
Gate it with consent correctly
Set the tag's consent settings to the right category, and check in Preview mode that it fires after consent.
Add to site-wide custom code
Go to Site settings, Custom code, and paste the affiliate script in Head code so it runs on every page. Publish the site.
Add tracking code to funnels and sites
Paste the script in the Tracking code (head) section of each funnel or website's settings. Check custom domains are connected, so the cookie is set on your own domain.
Add a custom code snippet
In Settings, Custom code, add the script, choose All pages and place it in the head. Check it is not limited to one page.
Use Code Injection
In Settings, Advanced, Code Injection, paste the script in the Header field so it loads on all pages.
Set the cookie with the right attributes
If you write the cookie yourself, set Domain to your root domain, Path to /, a clear expiry, SameSite=Lax and Secure. See the snippet below.
(function () {
var params = new URLSearchParams(window.location.search);
var ref = params.get('ref');
if (!ref) return;
var days = 30;
var expires = new Date(Date.now() + days * 864e5).toUTCString();
document.cookie = 'partner_ref=' + encodeURIComponent(ref) +
'; expires=' + expires +
'; path=/; domain=.example.com; SameSite=Lax; Secure';
})();Broken
- Domain: www.example.com
- Checkout on shop.example.com cannot read it
- Script only on the home page
- Banner blocks script with no later release
Fixed
- Domain: .example.com
- Checkout reads the partner ID
- Script loads on every landing page
- Script runs after consent is given
How to confirm it's fixed
- In a private window, a referral link creates the cookie in DevTools
- The Domain column shows your root domain, or matches the checkout hostname
- Path is / and Expires matches your attribution window
- The cookie is still present on the checkout and thank-you pages
- A test order in your affiliate dashboard shows the right partner
- The check also works after accepting the consent banner
- The check also works in Safari or a browser with strict tracking protection
How to prevent it happening again
Most regressions come from changes elsewhere: a new checkout domain, a redesigned landing page without the script, a new consent banner, a caching rule or a redirect. Add a cookie check to your release checklist for any of these changes. Keep a test referral link on file and run it after each change.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. It uses a cookie matcher: during a scheduled journey, the robot visitor checks whether the cookie you expect is present and whether its domain fits the site it ran on. A missing or mismatched cookie is flagged. A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause.
What it does not do: it does not confirm that your affiliate platform credited a real partner, that commissions were calculated correctly, or that every browser and tracking-protection setting keeps the cookie. It also never clicks real partner links in the wild or places real paid orders. Cover the rest by hand: run the DevTools check above with a test referral link, place a test order where your affiliate tool supports one, and look for it in the partner dashboard. Test traffic is marked with utm_source=funnelguard and fg_test=1, so filter it out of partner reports if it appears.
The Free plan covers 1 site and 2 journeys with daily checks and no card. A free read-only website audit is also available.
Questions people ask
Why is my affiliate cookie not being set?
Common causes are an affiliate script that is not on the landing page, a consent banner blocking it, or a redirect that strips the referral parameter before the script runs. Test with a referral link in a private window and check DevTools, Application, Cookies. Fix whichever step is missing.
What is the right cookie domain for affiliate tracking?
Use your root domain, written as .example.com, when your site and checkout sit on different subdomains. A cookie set on www.example.com only is not visible to shop.example.com. If checkout is on a different domain entirely, pass the partner ID in the URL or order data instead.
How do I check if my affiliate cookie is working?
Open your site in a private window using a partner link, then open DevTools and look under Application, Cookies. Check the cookie exists, the Domain and Path are right, and it is still there on the checkout and thank-you pages. Then place a test order and look for it in your affiliate dashboard.
Why do affiliates say they are not getting credit for sales?
Often the cookie never reaches the order. It may be set on the wrong domain, expire too soon, be blocked by consent settings or be lost when checkout runs on another domain. Check the cookie from the first click through to the confirmation page.
Do affiliate cookies work on a different checkout domain?
Not by themselves, because browsers only send a cookie to the domain that set it (or its subdomains). For a separate checkout domain, use your tool's cross-domain support or carry the partner ID in the URL, cart attributes or order metadata.
Does a cookie consent banner block affiliate tracking?
It can. If your banner classes the affiliate script as marketing or analytics, the script waits for consent and no cookie is set before then. Classify it correctly and load it after the visitor agrees, rather than forcing it to run.
Can FunnelGuard fully monitor my affiliate tracking?
No, it covers this only partly. It checks the expected cookie and its domain during a scheduled journey, but it does not confirm that partners were credited in your affiliate platform. Check that by hand with a test referral and test order.
Related issues
- TRK-259Affiliate tracking script missing (Impact, PartnerStack, Rewardful)Fix guide
- TRK-260Affiliate click ID (irclickid, ref) lost on redirectFix guide
- TRK-262Affiliate conversion pixel missing on order confirmationFix guide
- TRK-263Affiliate conversion fires for every order including non-affiliateFix guide
- TRK-264Coupon-code attribution conflicts with affiliate cookieFix guide
- TRK-265Shopify/Stripe affiliate integration not passing order IDsFix guide