Skip to content

Complianz not blocking GA4 or Meta Pixel: causes and fixes

Complianz is installed but Google Analytics or the Meta Pixel still loads before consent. How to find the leak in DevTools and fix it in Complianz.

Lukas Kontur · · 7 min read

Complianz is one of the most widely used consent plugins on WordPress and WooCommerce. In our scan of 97,304 EU websites it was the fourth most common consent platform we could identify, on 1,590 sites (full study). It blocks known tracking scripts until a visitor agrees. When Google Analytics or the Meta Pixel still runs before consent, the plugin is usually not broken: it simply cannot see or reach the script that leaks. This guide shows how to find that script and close the gap.

The symptoms

  • A scan reports analytics cookies before consent (_ga, _ga_ plus an ID, _gid) or marketing cookies before consent (_fbp), even though the Complianz banner is visible.
  • The Complianz dashboard looks complete and its own cookie scan lists the cookies correctly, but your browser shows them before any click.
  • Everything worked until you installed or updated a speed, caching or tracking plugin.

How common is this? In our study, 31.1% of all sites set analytics cookies before the visitor made a choice, and 18.3% set marketing cookies. A consent plugin being installed does not mean every script is behind it.

How to check it yourself

  1. Open a new private window in Chrome and press F12.
  2. In the Network tab, filter for collect (GA4 sends to /g/collect), then for facebook. Load your site without clicking the banner.
  3. In Application, Cookies, check for _ga and _fbp.
  4. For each request you find, click it and open the Initiator tab to see which file started it. Typical answers: a file under wp-content/plugins/ (a tracking plugin), googletagmanager.com/gtm.js (your GTM container), or a combined file from a caching plugin, often under wp-content/cache/.
  5. Click the first request (your page) and look at Response Headers. A Set-Cookie header for a tracking cookie means it comes from the server, not from a script.

Complianz documents a useful trick for stubborn cases: in the Network tab, right-click a JavaScript file and choose Block request URL, clear the site's cookies, reload, and see whether the cookie comes back. Repeat file by file until you find the one that sets it (Complianz: Still cookies?).

Why it happens

  1. A caching or optimisation plugin changes the scripts. Plugins that minify, combine, delay or defer JavaScript can rename files or change their order. Complianz then no longer recognises the tracking script, or its own script runs too late.
  2. The service is not enabled in Integrations. Complianz blocks services from a maintained list. If the service you use is not switched on, or the script is not on the list, nothing is blocked.
  3. A tracking plugin adds the pixel in a way Complianz does not know. For example a pixel plugin that changes its script names in an update.
  4. Google Tag Manager fires the tags. If Complianz is told that GTM loads statistics, the consent decision has to reach GTM, and every tag in the container needs a consent rule. Tags without one fire anyway.
  5. The cookie is set by the server. Complianz says that if cookies remain even with all JavaScript blocked, the cookie is probably set server-side in PHP, which the Script Center cannot block (same "Still cookies?" page).
  6. Google tags run in advanced consent mode. In this mode Google tags load before consent with all signals "denied". You will see requests to Google, normally without the _ga cookie. This is a configuration choice, explained in the fix below.

The fix

Step 1: exclude Complianz from optimisation

In your caching or speed plugin, exclude Complianz from minify, combine, delay and defer. Complianz lists the keywords complianz and cmplz and the banner file cookiebanner/js/complianz.min.js (under the complianz-gdpr plugin folder, or complianz-gdpr-premium for the premium version) for this. In LiteSpeed Cache the fields are called JS Excludes and JS Deferred/Delayed Excludes (Complianz: caching and optimisation plugins). Clear all caches, including Cloudflare if you use it, then test again.

Step 2: enable the right services in Integrations

In WordPress go to Complianz, Integrations. Under services, switch on everything your site uses: Google Analytics, Facebook, YouTube and so on. Under plugins, check that your tracking plugins are recognised (Complianz: integrating plugins). Complianz states that when Facebook is enabled under integrations, it is blocked by default and "will work with related plugins as well" (Complianz: WooCommerce integrations).

Step 3: add the leaking script to the Script Center

If Initiator showed a script Complianz does not know, add it in the Script Center (inside Integrations):

  • Under "Block a script, iframe or plugin", enter part of the script's URL in the field "URLs that should be blocked before consent" and choose the category (statistics or marketing). As the URL, we suggest a distinctive part of the address you found in the Initiator tab, for example connect.facebook.net or the plugin folder name.
  • If you paste a script yourself, use "Add a third-party script" and pick the category there.

If you or your developer write the HTML yourselves, Complianz documents this markup for scripts that must wait for consent (Complianz developer guide):

<script type="text/plain" data-category="statistics" data-service="matomo">
  // analytics code here
</script>

The documentation uses Matomo as the example service. Use data-category="marketing" for advertising pixels.

Step 4: tell the Wizard how Google is loaded

Run the Wizard and go to Consent, Statistics. Choose the option that matches your site, for example "Yes, with Google Analytics" or "Yes, and Google Tag Manager fires this script" (Complianz: Consent Mode v2 guide). If you chose "Yes, with Google Analytics", let Complianz add the Google tag and switched on Consent Mode V2, the Statistics configuration step of the premium version asks "Do you want to block all Google Tags before consent?":

  • Yes means Google tags do not load at all until consent. Choose this if you want no Google requests before a click.
  • No means Google tags load in advanced consent mode with "denied" signals. Complianz's guide recommends this for Google's modelling features. A scanner will then still show requests to Google before consent, normally without the _ga cookie.

Which one is right for you is a business and legal decision. The important part is that you choose it deliberately and that the result matches what your banner text says.

If GTM fires your tags (the GTM option with Consent Mode V2 on), the premium version asks "Will you be using our Tag Manager template?"; the guide above explains both answers. Either way, follow our GTM Consent Mode v2 guide so each tag waits for consent.

Step 5: remove duplicate Google tags

If the statistics options are missing in the Wizard, Complianz's Consent Mode guide tells you to disable a conflicting integration under Integrations, Plugins, such as Site Kit, MonsterInsights, Google Analytics for WooCommerce or GTM4WP. Our advice beyond that: if two plugins load GA4, keep only one. On WooCommerce, see also GA4 and Google Ads on WooCommerce: Consent Mode v2.

Step 6: server-side cookies

If the Set-Cookie check found a tracking cookie in the page's response headers, script blocking cannot help. Find the plugin that sets it (deactivate tracking plugins one by one on a staging copy and repeat the header check) and either configure that plugin to wait for consent or replace it. A known example is the Meta for WooCommerce plugin, covered in Meta Pixel fires before consent on WooCommerce.

How to verify the fix

  1. Clear every cache (plugin, server, Cloudflare).
  2. New private window, no click: no _ga, _ga_ or _fbp cookie. No facebook requests. No /g/collect requests if you chose to block Google tags; if you chose advanced mode, /g/collect requests may appear but _ga must not.
  3. Deny or Reject, then reload: still no tracking cookies, also on a product page and the cart.
  4. Accept (new private window): _ga and _fbp appear. This proves you did not switch off tracking for visitors who agree.
  5. Repeat the test after every plugin update. Complianz relies on recognising scripts, so a renamed file in an update can reopen the leak.

Sample scan

78 / 100

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

See sample report →

Background: Pre-consent tracking explained.

Check your site in 1 minute

Our free scan loads your site in a clean browser, records which scripts and cookies run before the Complianz banner is answered, and shows the exact request that leaked. No signup needed. Run a free scan.

Get alerted when it breaks

An update to a caching or tracking plugin can reopen a leak you already fixed. With monitoring, we re-scan your site on a schedule and email you when a tracker starts running before consent. Create an account and add your site.

Last updated: