Many cookie banners show a message and store the visitor’s answer, but they do nothing about the scripts already on the page. If Google Analytics or an ad pixel is in your HTML, it runs while the banner is still on screen. Auto-blocking, sometimes called prior blocking, is the fix for that gap.
What auto-blocking means
Auto-blocking means your consent tool holds non-essential scripts and embeds before they run, then releases only the ones the visitor agrees to. “Auto” means the tool recognises common trackers by itself, so you do not have to tag every script by hand.
Without blocking, or another way of gating scripts, a banner may be only a notice. Auto-blocking makes the visitor’s choice control the trackers it recognises.
How it works
Using Cookie Compliance as the example, here is what happens on a first visit, before any choice is saved:
- Recognise. The banner checks the page’s scripts and iframes against a built-in list of hundreds of tracker patterns: analytics, advertising, tag managers, video embeds, widgets and more. It keeps watching the page, so scripts added later, for example by a tag manager, are checked too.
- Hold. A recognised non-essential script is not allowed to run. In the page, the tag’s
typebecomesjavascript/blockedand it gets ahu-blockedclass. For an external script (one loaded from a file), its address also moves fromsrctodata-src. Recognised iframes are held too. - Ask. The visitor sees the banner and chooses.
- Release by purpose. Each provider belongs to one of four purpose categories: 1 Basic Operations, 2 Content Personalisation, 3 Site Optimisation, 4 Ad Personalisation. Only providers in categories the visitor accepted are released. Basic Operations are never held.
- Remember. The choice is saved.
For a returning visitor, the saved choice applies from the start of each page: providers in accepted categories run straight away, the rest stay held, and the visitor is usually not asked again.
If a visitor changes their mind, the new choice is saved straight away. What happens next depends on the direction:
- Accepting more. Held providers in the newly accepted categories are released on the same page.
- Withdrawing consent. Providers that are still held stay held. A provider that has already run cannot be stopped mid-page. It keeps running until the next page load, when only providers matching the new choice are released. For immediate effect, switch on the Reloading setting, which reloads the page after a choice is saved.
Auto-blocking and Consent Mode are different things
People often mix these up. They do different jobs. Cookie Compliance supports both, but Consent Mode is off by default and must be switched on separately.
| Auto-blocking | Consent Mode (Google, Microsoft, Meta) | |
|---|---|---|
| What it does | Stops a script from running until consent | Tells a vendor’s own tags what the visitor chose |
| Which scripts | Any recognised script or iframe | Only tags that read that vendor’s signal |
| Before consent | The held script does not run | A “denied” default is set for the vendor’s tags to read when they run |
Consent Mode signals do not replace blocking, and blocking does not send Consent Mode signals.
The limits
Auto-blocking has limits. These are the ones to plan for.
1. A held file may still download
Browsers start fetching script files they find ahead in the page. A held file may be requested, but its code does not run or start further requests. The file’s own response can still carry cookies set by the server that sends it. When you test, check cookies and network requests; the file request alone is not a failure.
2. Scripts the banner does not recognise run
Blocking holds what matches a pattern, whether it is in the page from the start or added later (for tags fired by Google Tag Manager, see Cookie consent with Google Tag Manager). For a tracker the built-in list does not recognise, add your own URL pattern in Autoblocking, or mark the script with data-hu-category.
Tag managers are the common case. On the New engine, Cookie Compliance holds the Google Tag Manager container until the visitor accepts Content Personalisation, whether Consent Mode is on or off, and holds recognised tags GTM fires (for example Google Analytics, which belongs to Site Optimisation) until their own category is accepted. On the Classic engine, GTM runs straight away when Google Consent Mode is on, and otherwise once the visitor accepts Content Personalisation. On both engines, gate the tags GTM fires with consent triggers inside GTM. A self-hosted or unusual loader, or inline or obfuscated code, may also go unrecognised. Use the test guide to find these. You can then:
- Add a URL pattern to an existing provider in the Cookie Compliance dashboard (Autoblocking). This works on the Free plan.
- Add a new provider, or change a provider’s category. These are Professional features.
- Mark a script yourself by giving it the class
hu-blockand adata-hu-categoryvalue from 1 to 4 (1 Basic Operations, 2 Content Personalisation, 3 Site Optimisation, 4 Ad Personalisation). Ahu-blockscript with no category, or a number outside 1 to 4, is held as Content Personalisation.
3. Placement
The banner can only hold scripts that have not run yet. Its snippet must be the first script in <head>, on every page, without async or defer. On WordPress, the plugin handles placement.
4. The Free plan visit limit
Blocking on the Free plan works up to the Free plan’s visit limit (see Pricing). Each page view where the banner loads counts as a visit. The limit runs on a repeating 30-day cycle that starts on the date the site’s app was created, not on the first of the month. If a site goes past it, blocking and server-side consent records pause until the next cycle starts, so trackers are not held during that time. The banner still shows and the visitor’s choice is still stored in their browser. Upgrading to Professional turns them back on. If Google Consent Mode is on and signals are mapped, Consent Mode signals continue. The Professional plan has no visit limit.
5. Switches and settings
Blocking only works while it is switched on. On a pasted snippet, the blockingEngine key is the master switch and blocking controls holding before consent. On WordPress, these are the Script blocking engine and Autoblocking switches, and scripts are not blocked for administrators, so test while logged out.
Why “blocked by default” matters
Cookie Compliance holds recognised non-essential scripts by default, until there is a recorded choice that covers them. You can change that default, for example with region rules (a Professional feature). Auto-blocking does not by itself make a site compliant with any law. It is one mechanism, alongside a clear notice, real choices and records of consent.
How to check yours
See How to test whether your cookie banner really blocks trackers. It works with any tool.
FAQ
Does auto-blocking stop the script file from downloading?
Not always. The browser may request a held file, but its code does not run or start further requests. The file’s own response can still carry server-set cookies, so check cookies as well as requests.
Is auto-blocking included on the Free plan?
Yes, up to the Free plan’s visit limit (see Pricing). Past that, blocking pauses until the next 30-day cycle, or until you upgrade to Professional. On Free you can add URL patterns to existing providers. Adding a new provider, or changing a provider’s category, needs Professional.
Does auto-blocking work with Google Tag Manager?
Yes. Gate the tags GTM fires with consent triggers inside GTM. On the New engine, the GTM container is held until the visitor accepts Content Personalisation and recognised tags it fires are also held automatically. On the Classic engine, GTM runs straight away when Google Consent Mode is on. See Cookie consent with Google Tag Manager.
Do I still need Google Consent Mode if I use auto-blocking?
If you use Google’s tags, it is worth switching on. Blocking decides whether a script runs. Consent Mode tells Google’s tags what the visitor chose once they do run. Whether you must use it depends on the Google products you use, so check Google’s requirements for them.