A cookie banner does not automatically prevent third-party scripts from executing.
A website can display an attractive consent interface while analytics tags, advertising pixels and embedded services are already making network requests.
For developers, the real task is to connect consent decisions to script execution.
This guide covers how to discover third-party tracking, configure script blocking, use Google Tag Manager consent controls and verify that the implementation works.
1. Understand the Difference Between Cookies and Scripts
A third-party cookie is a browser storage item associated with a domain other than the website being visited.
However, the script that creates or accesses a cookie is a separate part of the implementation.
For example:
Website
|
|-- Analytics Script
|-- Advertising Pixel
|-- Marketing Script
|-- Embedded Video
|-- Live Chat Widget
A script may:
- Create cookies.
- Read existing cookies.
- Access local storage.
- Send network requests.
- Load additional scripts.
- Collect events without using conventional cookies.
Therefore, blocking only a cookie name is not always enough. Developers need to control the technology that generates the tracking activity.
2. Identify Third-Party Tracking
Start by inspecting the website's external requests.
In Chrome DevTools:
- Open an incognito window.
- Open Developer Tools.
- Select Network.
- Enable Preserve log.
- Clear the site's stored data.
- Reload the website without clicking the banner.
- Inspect requests to external domains.
- Review cookies and local storage in the Application tab.
Repeat after accepting and rejecting consent.
Look for:
- Google Analytics.
- Google Ads.
- Meta Pixel.
- LinkedIn Insight Tag.
- Marketing automation scripts.
- Heatmap services.
- Embedded video and map services.
Do not rely only on the cookie list. A network request may occur without a conventional cookie being created.
3. Establish Consent Before Tags Execute
A good implementation establishes default consent states before relevant tracking tags run.
When using Google Tag Manager, the Consent Initialization trigger is designed to run consent-setting tags before other triggers.
Google documents this mechanism in its Tag Manager consent guide.
The high-level sequence should be:
Page Initialisation
|
v
CMP Initialisation
|
v
Set Default Consent
|
v
Visitor Interaction
|
v
Update Consent State
|
v
Allow Configured Tags
The CMP should load early enough to avoid a race condition where a marketing or analytics tag fires first.
4. Configure Consent Checks in Google Tag Manager
GTM provides built-in consent checks for supported Google tags and additional consent checks for other tags.
For a third-party tag:
- Open the relevant tag.
- Go to Advanced Settings.
- Open Consent Settings.
- Review the available consent configuration.
- Add required consent types where appropriate.
- Save and test in Preview mode.
For example, a marketing tag may require a specific advertising consent category before it is allowed to fire.
The exact category mapping should reflect the service's purpose and your CMP configuration.
Use the GTM Consent Overview to identify tags that have not been reviewed.
Important: Do not blindly add additional consent checks to every Google tag. Google tags have built-in consent checks, and combining them incorrectly with additional checks can cause unexpected behaviour. Follow Google's current implementation guidance.
5. Google Consent Mode v2 Is Not a Universal Script Blocker
Google Consent Mode communicates consent signals to supported Google tags.
It supports two broad implementation approaches.
Basic Consent Mode
- Google tags remain blocked until the visitor interacts with the banner.
- No data is transmitted to Google before interaction.
- Tags can load after consent is granted.
- Tags remain blocked if consent is denied.
Advanced Consent Mode
- Google tags load with configured default consent states.
- They can operate with denied storage states.
- Supported tags may send cookieless measurement pings while consent is denied.
- Their behaviour changes after the visitor's choice.
Advanced Consent Mode is not the same as blocking all tracking scripts.
Read the Google Consent Mode documentation.
6. Use a CMP for Script Blocking
A CMP connects user preferences with the technologies installed on the website.
A typical workflow:
- Scan the website.
- Identify tracking technologies.
- Assign appropriate categories.
- Configure the consent interface.
- Establish default consent states.
- Block configured non-essential scripts.
- Update consent when visitors interact.
- Verify actual browser behaviour.
ConsentX offers prior-script blocking on Pro and higher plans, alongside its xScan-AI privacy scanner.
The scanner can help identify cookies, trackers, scripts and third-party technologies operating on public website pages.
A scan does not replace manual testing. Developers should validate dynamic scripts, tag manager integrations and third-party embeds.
7. WordPress Implementation Considerations
WordPress tracking can originate from:
- Plugins.
- Themes.
- Header and footer scripts.
- Google Tag Manager.
- Embedded services.
- Marketing integrations.
A CMP plugin can help manage consent, but developers should verify every relevant integration.
The ConsentX WordPress plugin provides consent-management functionality.
After installation:
- Configure the consent categories.
- Identify scripts that need consent.
- Configure script blocking.
- Test plugins and external integrations.
- Inspect network requests before consent.
- Test acceptance, rejection and withdrawal.
Never assume that installing a CMP automatically controls every script installed by other plugins.
8. Browser Testing Checklist
Use a clean browser session for each test.
[ ] Banner appears on first visit
[ ] Consent defaults are established early
[ ] Non-essential scripts remain blocked before consent
[ ] Network requests are inspected
[ ] Cookies are checked
[ ] Local storage is checked
[ ] Accepting consent updates tag behaviour
[ ] Rejecting consent keeps relevant tags blocked
[ ] Withdrawal updates consent state
[ ] Preferences persist across pages
[ ] Mobile behaviour is tested
Test both static scripts and scripts loaded dynamically after page interaction.
9. Common Implementation Errors
Loading the CMP too late: Tracking scripts may execute before consent controls are ready.
Blocking cookies but not scripts: Other data collection may continue.
Assuming Consent Mode blocks every vendor: It primarily controls supported Google tags.
Ignoring tag manager configuration: A tag without appropriate consent controls may still execute.
Not testing withdrawal: A visitor's updated choice should be respected.
Relying only on scans: Scanners may not detect every dynamic or authenticated-page technology.
Conclusion
The most important part of cookie consent implementation is not the banner. It is the connection between consent decisions and actual script behaviour.
Developers should discover third-party technologies, establish consent defaults early, configure GTM consent checks and verify network activity in a clean browser session.
Explore ConsentX for consent management, privacy scanning and prior-script blocking capabilities.
Top comments (0)