Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 2 min read

Why WordPress PixelYourSite Silently Overrides CookieYes, Complianz & OneTrust (Hardcoded "granted" Bug)

If your WordPress site runs PixelYourSite alongside CookieYes, Complianz, or OneTrust, your cookie banner can look 100% compliant in the UI while still firing Meta Pixel (fbq), TikTok Pixel, and unrestricted GA4 pings on

If your WordPress site runs PixelYourSite alongside CookieYes, Complianz, or OneTrust, your cookie banner can look 100% compliant in the UI while still firing Meta Pixel (fbq), TikTok Pixel, and unrestricted GA4 pings on Cold Load, California Sec-GPC: 1, and even after clicking "Reject All" + Reload.

The Root Cause: Hardcoded "granted" Inside var pysOptions

When we audited 72 live US clinic & medspa websites and 53 live US Shopify stores (125 sites total, all anonymized) using automated 3-state headless Chromium .har captures:

  • 66.7% (6 of 9) of sites actively paying for a CMP still leaked trackers on cold load.
  • 77.8% (7 of 9) of clickable "Reject All" banners kept transmitting ad or analytics pings after a hard reload.
  • 59.7% (43 of 72) of live US clinic/medspa sites ignored Sec-GPC: 1.

On WordPress + WooCommerce sites, one of the most common culprits is PixelYourSite injecting an inline var pysOptions configuration object that hardcodes Google Consent Mode flags to "granted" before your CMP script loads or evaluates consent:

// Typical leak observed in rendered WordPress HTML source:
var pysOptions = {
  "staticEvents": { /* ... */ },
  "gdpr": {
    "all_disabled_by_api": false,
    "google_consent_mode": true,
    "analytics_storage": "granted",
    "ad_storage": "granted",
    "ad_user_data": "granted",
    "ad_personalization": "granted"
  }
};

Even when CookieYes, Complianz, or OneTrust later sets a denied cookie or CMP state, PixelYourSite has already initialized fbq('init', ...) / gtag('consent', 'default', { ... 'granted' }) during initial HTML parseβ€”or overwrites the CMP's consent signal on every page view.

How to Verify in 30 Seconds (DevTools or HAR)

  1. Open an Incognito window and load your WordPress site with Chrome DevTools Network open (check Preserve log).
  2. View Page Source (Cmd+Option+U / Ctrl+U) and search for pysOptions or ad_storage.
  3. Filter the Network tab for facebook.com/tr, clarity.ms, or google-analytics.com/g/collect.
  4. Look at the GA4 gcs query parameter on cold load and after clicking Reject All + reloading:
    • gcs=G100 indicates consent denied.
    • gcs=G111 indicates both ad_storage and analytics_storage fired as granted.

The Fix: Enforce Default-Deny Before Any Plugin Script

  1. Disable PixelYourSite's forced consent defaults (or enable its explicit CMP integration for CookieYes / Complianz / OneTrust instead of auto-granting consent).
  2. Place a strict Consent Mode v2 default-deny block at the very top of <head> before GTM, pysOptions, or any pixel loader:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
  'ad_storage': 'denied',
  'ad_user_data': 'denied',
  'ad_personalization': 'denied',
  'analytics_storage': 'denied',
  'wait_for_update': 500
});
</script>
  1. Re-test Cold Load, Sec-GPC: 1, and Reject All + Reload in a fresh browser context to verify zero pre-consent facebook.com/tr requests and gcs=G100 on GA4.

Open-Source Benchmark & Hosted Scanner

(Technical browser observation only; not legal advice.)

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.