Skip to content

CookieYes not blocking cookies before consent: how to fix it

CookieYes shows a banner, but analytics or ad cookies are set before visitors choose. How to check it in DevTools and fix the CookieYes settings.

Lukas Kontur · · 6 min read

CookieYes is a popular consent banner for WordPress and other website builders. It can block common tracking scripts automatically until a visitor agrees. But "banner visible" and "scripts blocked" are two different things. If you see _ga, _fbp or other tracking cookies before anyone clicks your CookieYes banner, this guide helps you find out why and fix it, step by step.

The symptoms

  • A scan report shows trackers before consent or analytics or marketing cookies before consent, while the CookieYes banner is on screen.
  • The banner looks right, but the Meta Pixel Helper or Tag Assistant shows tags firing before a click.
  • After clicking Reject All, some cookies stay or come back on the next page.

In our scan of 97,304 EU websites, 31.1% set analytics cookies and 18.3% set marketing cookies before any consent choice (full study). Having a banner installed is not the same as having scripts blocked.

How to check it yourself

  1. Open a new private window in Chrome and press F12.
  2. Click Network, load your site, and do not touch the banner.
  3. Filter for collect (Google Analytics), facebook, tiktok, hotjar and clarity, one at a time.
  4. In Application, Cookies, look for _ga, _fbp, _ttp or other tracking cookies. The CookieYes consent cookie itself (cookieyes-consent) is expected; it stores the visitor's choice.
  5. For each tracking request, click it and open Initiator to see which file loaded it.
  6. Click Reject All, reload, and repeat steps 3 and 4.

Why it happens

  1. The banner is set up as an information notice. CookieYes documents that blocking only happens with the "Explicit" and "Implicit" consent types. With "Info", "cookies are not blocked at all" (CookieYes: prior consent).
  2. The CookieYes script loads too late. CookieYes's troubleshooting page answers "Why aren't cookies on my website blocked before user consent?" with: place the CookieYes script at the top of the <head> (CookieYes troubleshooting). Anything that runs before it cannot be blocked.
  3. A speed plugin delays or moves the CookieYes script. "Delay JavaScript", "defer" and "combine" features can push the banner script behind your trackers. CookieYes's troubleshooting page recommends excluding its script from optimisation plugins (in its answer about an empty banner).
  4. The script is not one CookieYes recognises. Automatic blocking covers "most of the commonly used third-party service scripts", not every script.
  5. The tag comes from Google Tag Manager. If GTM loads your tags, CookieYes blocks GTM's own tags only if each tag has a consent rule or GTM itself is held back.
  6. The cookie is set by your server. Script blocking cannot stop a Set-Cookie header that arrives with the page.
  7. Two consent tools are active at once. After switching from another banner plugin, leftovers of the old one (or a theme's built-in cookie notice) sometimes stay active. Two tools can disagree about the visitor's choice, and tags may follow the wrong one. Keep exactly one consent tool and remove the rest, including any old consent snippet in your theme or GTM.

The fix

Older CookieYes versions had a preset "Consent Type" setting, which CookieYes says is being retired. In the current version, go to Cookie Banner, Content, Cookie Notice, enable the Reject All and Preferences buttons, and publish (CookieYes: consent type in the new version). The goal is the behaviour CookieYes calls "Explicit": nothing non-essential runs before the visitor acts.

Step 2: put CookieYes first

  • WordPress plugin: the plugin adds the script for you. Make sure no other plugin or theme setting moves it.
  • Script added by hand or through a theme field: place the CookieYes script as the first script in <head>, above Google Analytics, GTM and any pixel.
  • Our advice: do not load CookieYes through GTM if you want it to block scripts that are not in GTM. It would load after them.

Step 3: exclude CookieYes from optimisation

In your caching or speed plugin (for example WP Rocket, LiteSpeed Cache, Autoptimize), add the CookieYes script to the exclusion lists for delay, defer, minify and combine. CookieYes links a dedicated guide for WP Rocket from its troubleshooting page. Clear all caches afterwards.

Step 4: add scripts CookieYes does not recognise

CookieYes documents two ways to block a script by hand (CookieYes: prior consent):

  • Without touching code: go to Cookie Manager, click + Add Cookie for the cookie in the right category, and fill in Script URL Pattern with part of the script's address, for example connect.facebook.net or static.hotjar.com.
  • In the HTML: add a data-cookieyes attribute to the script tag. The documented values include cookieyes-functional, cookieyes-analytics and cookieyes-performance. CookieYes notes the attribute is required only for external scripts with a src:
<script src="https://example-analytics.com/tag.js" data-cookieyes="cookieyes-analytics"></script>

Use the category that matches what the script does, and check the CookieYes page above for the current list of values before you use one for advertising scripts.

If you run GA4 or Google Ads, enable Google Consent Mode in CookieYes:

  • WordPress plugin: the plugin must be connected to the CookieYes web app. Go to the CookieYes dashboard, Google Consent Mode (GCM), switch on "Enable Google Consent Mode (GCM)" and confirm, set the default consent states and regions, then "Publish Changes" (CookieYes: GCM in WordPress).
  • Web app (other platforms): in the dashboard, Advanced Settings, "Support GCM". There is a separate toggle called "Allow Google tags to fire before consent". If you want no Google requests before a click, leave that toggle off (CookieYes: implementing GCM).

If GTM loads your tags, also set consent requirements on each tag. Our GTM Consent Mode v2 guide covers this. On WordPress, once the separate WP Consent API plugin is installed, CookieYes passes choices to it automatically, and plugins such as Site Kit can use them (CookieYes: WP Consent API).

Step 6: server-side cookies

If the page's Response Headers contain Set-Cookie for a tracking cookie, find the plugin responsible (test on a staging copy by deactivating tracking plugins one at a time). CookieYes cannot block cookies set by the server. For the most common WooCommerce case, see Meta Pixel fires before consent on WooCommerce.

How to verify the fix

  1. Clear all caches, then open a new private window.
  2. No click: no tracking requests for collect, facebook, tiktok or hotjar. In Cookies, only cookieyes-consent and genuinely necessary cookies.
  3. Reject All, then reload: still no tracking cookies or requests, also on a second page.
  4. Accept All (new private window): trackers and their cookies appear. Your analytics and ads still work for visitors who agree.
  5. If you enabled Consent Mode, check the Consent tab in Tag Assistant: On-page Default should show denied before the click, and On-page Update granted after Accept (the exact wording in the tool may differ) (Google: troubleshoot consent mode).

Sample scan

78 / 100

High risk · Trackers: 23 · Pre-consent tracking: yes

See sample report →

Background: Pre-consent tracking explained. Using Complianz instead? See Complianz not blocking GA4 or Meta Pixel.

Check your site in 1 minute

Our free scan loads your site like a first-time visitor, records which scripts run before the CookieYes banner is answered, then clicks Reject and checks again. No signup needed. Run a free scan.

Get alerted when it breaks

A new plugin, a theme change or a speed setting can move your scripts in front of the banner again. With monitoring, we re-scan your site on a schedule and email you when that happens. Create an account and add your site.

Last updated: