Block Google Analytics and Meta Pixel until consent
This guide sets up CookieRay so known trackers such as Google Analytics and Meta Pixel do not run until a visitor allows the matching category, and shows how to test it.
Step 1: Switch to Strict mode (Block Until Consent)
- Open CookieRay → Settings.
- Under Consent Behavior, choose Block Until Consent (called Strict mode in these docs). Log Consent Only records consent but never blocks.
- Save the configuration.
Step 2: Scan and categorize
- Run a cookie scan from the Dashboard or Scan History.
- Open Cookie Inventory and categorize detected cookies. Anything left uncategorized is blocked by default (see Settings → Uncategorized Cookie Handling for the other option, Treat Uncategorized Cookies as Marketing).
Step 3: Enable the banner
Turn on Show Cookie Consent Banner in Settings and check the look in Banner Design.
Step 4: Test in a clean browser
- Open your site in a private/incognito window.
- Open developer tools → Network, filter for
google-analytics,googletagmanagerorfacebook. - Before clicking anything on the banner, confirm no requests to the tracker are made.
- Click Accept All and confirm the requests now appear.
- Repeat with Decline — they should not appear.
Scripts CookieRay doesn’t recognize
Strict mode uses built-in patterns for common trackers. For a custom or uncommon script, mark it yourself — see Block a script yourself.
Meta Pixel with CookieRay Pro
If you add Meta Pixel through CookieRay Pro’s Integrations, the pixel starts with consent revoked and is granted only after the visitor allows marketing cookies.
If something still loads early
- Another plugin or theme may be printing the script in a way that bypasses the gate. Compare behavior in Log Only and Strict, and disable overlapping consent plugins.
- A page cache may be serving old HTML. Clear it after changing settings.
- See Troubleshooting.
CookieRay delays the scripts it recognizes. Verify your own stack — blocking behavior depends on how your site loads its scripts.