Blocking
How to block scripts and cookies before consent
Prevent optional scripts and iframes from running before a choice.
Classify before enabling
Map every technology to necessary, functional, analytics or advertising. Necessary is reserved for functions the visitor explicitly requests or that the service cannot securely provide without.
Example: an optional embedded video
List the iframe URL, provider and purpose before implementing the block. Render a local placeholder without the remote iframe source until the visitor permits that purpose. Even a hidden iframe can send a request if its source is already present.
On grant, create the permitted embed once. On withdrawal, stop future loading and remove or replace the active embed where your implementation supports it. Verify in a clean Network trace that neither the frame nor its vendor scripts requested data before permission. This pattern requires integration with your actual consent state; a CSS overlay is not a block.
Control execution
Use the generated blocking rules for known scripts and iframes. For application code, gate initialization on the category state and subscribe to later preference changes.
Blocking must cover every way a vendor can start: inline scripts, tag-manager tags, dynamically inserted scripts, embedded frames and server-side forwarding. A rule that covers only the initial HTML can leave later client-side activity ungoverned.
For Google Analytics specifically, use the GA4 blocking and network test to check direct scripts, GTM and duplicate installers.
Test both directions
Test first load, accept, reject, granular choices and withdrawal. Confirm that disabling a category stops future collection and clears storage where your documented implementation requires it.
Use a clean browser profile for each scenario and preserve a network trace. Browser storage alone is not proof: a request can disclose data even when no cookie is visible.