Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Affiliate cookie not set or wrong domain: how to find and fix it

TRK-261Medium impactPartlyBy FunnelGuardPublished Updated
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.

Where the credit gets lost
  1. Partner link clickVisitor lands with ?ref=anna
  2. Cookie savedSet on www.example.com only
  3. CheckoutRuns on shop.example.com, cookie not visible
  4. CommissionOrder has no partner attached

The cookie is set on the wrong domain, so the confirmation page cannot read it.

Orders credited to partnersExample numbers
Orders credited to partners (example)Real partner orders: 100 orders; Credited (cookie broken): 35 orders; Credited (fixed): 98 orders038771003598Real partner ordersCredited (cookie brok…Credited (fixed)orders

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

Check the cookie by hand
  1. Open a private window

    Use a fresh incognito or private window so old cookies do not confuse the result.

  2. 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.

  3. 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).

  4. 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.

  5. 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.

What the cookie columns should show
ColumnHealthy valueProblem value
Domain.example.com (root domain)Only www.example.com, or a different domain than checkout
Path//landing or another narrow path
ExpiresMatches your attribution window (for example 30 to 90 days)Session, or a few minutes
SameSiteLaxNone without Secure, or Strict on cross-site flows
SecureYes on HTTPSMissing on an HTTPS site
A script that never sets the cookie

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.

Fix the cookie
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Where to change it by platform
  1. 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.

  2. 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.

Example: save a partner ID in a cookie readable on all subdomainsjavascript
(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';
})();
Cookie settings before and after

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

Confirmation checks
  • 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.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: cookie matcher.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.