Knowledge base

Prior blocking

How to block Google Analytics before consent

Find every Analytics loader, prevent a first-visit request and verify the block across fresh, accepted and withdrawn states.

Editorial illustration for How to block Google Analytics before consent
Editorial illustration by Consentory.

In brief

To guarantee no GA4 request before permission, block the tag itself; denied Consent Mode signals alone allow Advanced-mode pings.

Find every Analytics path

Search the rendered page and GTM container for the GA4 measurement ID, Google tag, inline gtag.js, plugins and server-side forwarding. Include single-page app route changes. A second installer can bypass a carefully configured GTM block.

Block before execution

In GTM, require analytics consent before GA4 tags fire and make sure an accepted choice can trigger them. With direct script loading, do not insert the GA4 script until consent is granted. If you use Consentory's prior blocking, classify and control the actual tracker path, then verify the published behavior.

Set Consent Mode defaults separately. A blocked GA4 tag cannot establish your overall default for other Google tags.

For the wider script and iframe inventory, review how to configure prior blocking so a second integration cannot bypass your Analytics rule.

Run a clean-room test

Clear site data or use a fresh browser profile. Open DevTools Network with Preserve log, load the page and do not interact with the banner. Filter for your measurement ID, googletagmanager.com, google-analytics.com and first-party proxy endpoints.

No GA4 script, collect request or Analytics storage should appear before permission if your goal is strict prior blocking. A banner displayed on top of the page is not evidence of a block.

Grant, reject and withdraw

Accept Analytics only and confirm a single GA4 initialization and expected event. Repeat from a clean profile with Reject all. Then accept, open preferences and withdraw: future hits should stop and the consent update should reflect denial.

Document the boundary

Record which requests you count as Analytics, how a first-party proxy is treated and which regions use this behavior. If you intentionally choose Advanced mode, document the limited pre-consent pings instead of describing the setup as fully blocked.

Try it

Pre-consent network test plan

0 of 7 checked

This checklist stays on this page only. Save your evidence in your own release record.

Continue with a related guide

Primary sources

Reviewed 15 October 2026. Validate product interfaces and requirements for your own implementation.

Check the implementation on your site

Consentory helps teams inspect trackers, configure prior blocking and document consent choices. The guides above give you a test plan before rollout.