Want to keep Google Analytics, Google Ads, and Google Tag Manager running while respecting visitor privacy? WPConsent integrates with Google Consent Mode v2 to let Google services collect anonymized data until visitors accept your banner. Google Consent Mode v2 gives you the best of both worlds: privacy compliance and continued data collection.
Table of contents
- Prerequisites
- Understanding how it works
- Enabling Google Consent Mode
- Verifying Google services are detected
- Understanding the relationship with script blocking
- Choosing your default consent state
- Saving your settings
- Verifying your setup
- Plugin compatibility
- Troubleshooting
- FAQ
- Conclusion
Prerequisites
Before you begin, make sure you have:
- WPConsent installed and activated
- The consent banner enabled in WPConsent >> Settings
- At least 1 Google service detected in your cookie database (for example, Google Analytics, Google Ads, or Google Tag Manager). Run a scan if you haven’t already
Understanding how it works
Google Consent Mode v2 is an API that tells Google tags how to behave based on a visitor’s consent choices. It operates in 2 phases: a default phase and an update phase.
Default phase (page load)
When the page loads, WPConsent outputs a script at the very top of (priority 5) that sets all consent parameters to their default state. In opt-in mode (the default), all parameters start as denied. Google services can still load and collect anonymized, cookieless data during this phase.
The default consent script sets these parameters:
| Google consent parameter | Default state (opt-in) | Controlled by |
|---|---|---|
ad_storage | denied | marketing category |
ad_user_data | denied | marketing category |
ad_personalization | denied | marketing category |
analytics_storage | denied | statistics category |
functionality_storage | granted | Always granted |
security_storage | granted | Always granted |
The script also includes wait_for_update: 500, which tells Google tags to wait up to 500 milliseconds for a consent update before proceeding. This prevents any race condition between the banner and your tracking tags.
Update phase (after consent)
When a visitor accepts cookies through your banner, WPConsent fires gtag('consent', 'update', {...}) with the appropriate values based on the visitor’s choices:
- If the visitor accepts the marketing category,
ad_storage,ad_user_data, andad_personalizationchange togranted. - If the visitor accepts the statistics category,
analytics_storagechanges togranted. - If a category is rejected, its parameters remain
denied.
WPConsent also pushes a wpconsent_consent_processed event to the window.dataLayer array. This event includes the visitor’s full consent preferences and can trigger tags in Google Tag Manager.
Simple mode vs advanced mode
Google Consent Mode v2 has 2 implementation modes: simple mode and advanced mode. The difference comes down to whether Google scripts load before or after a visitor gives consent.
Advanced mode (default)
When the Google Consent Mode toggle is enabled in WPConsent >> Settings, your site runs in advanced mode. This is the default behavior.
In advanced mode, Google scripts (Analytics, Ads, Tag Manager) load immediately when the page opens, but they run in a restricted, cookieless state. Google collects anonymized, aggregated data (sometimes called “pings”) even before the visitor interacts with your banner. Once the visitor accepts cookies, WPConsent updates the consent state and Google switches to full tracking.
Advanced mode gives you the most complete data because Google can model conversions from the anonymized signals collected before consent.
Simple mode
To use simple mode, turn off the Google Consent Mode toggle in WPConsent >> Settings while keeping Automatic Script Blocking enabled.
In simple mode, Google scripts don’t load at all until the visitor accepts cookies. No data is collected, no pings are sent, and no cookies are set before consent. Once the visitor accepts, WPConsent unblocks the Google scripts and they load for the first time.
Simple mode is more privacy-conservative because nothing runs before consent. However, you lose the anonymized data that Google uses for conversion modeling, so your analytics and ad reporting may have larger gaps.
Which mode to choose
| Simple mode | Advanced mode | |
|---|---|---|
| Google scripts before consent | Blocked entirely | Load in restricted mode |
| Anonymized data collection | No | Yes |
| Conversion modeling | Not available | Available |
| Privacy level | Higher | Standard |
| Setup | Disable Google Consent Mode, enable Automatic Script Blocking | Enable Google Consent Mode (default) |
For most sites, advanced mode is the recommended choice. It’s the setup that Google recommends and it preserves the most data. If your privacy policy or legal requirements prohibit any data collection before consent, use simple mode instead.
Enabling Google Consent Mode
To get started, navigate to WPConsent >> Settings in your WordPress admin.
Next, find the Google Consent Mode toggle in the settings list. This toggle is enabled by default.
If it was previously disabled, turn it on to activate Google Consent Mode v2.

Google Consent Mode requires the consent banner to be enabled. If the banner is disabled, the consent mode script won’t load.
Verifying Google services are detected
WPConsent only outputs the consent mode script if at least 1 service in your cookie database has “google” in its slug.
To check, go to WPConsent >> Settings and confirm you have at least 1 Google service listed (such as Google Analytics, Google Ads, or Google Tag Manager).
If no Google services appear, run a scan to detect them. The consent mode script won’t load until a Google service is found.
Understanding the relationship with script blocking
When Google Consent Mode is enabled, WPConsent automatically skips script blocking for these 3 services:
google-analyticsgoogle-tag-managergoogle-ads
This is intentional. Google Consent Mode allows these scripts to load immediately in a restricted mode. Instead of blocking them entirely, WPConsent uses Google’s own consent API to control what data they collect. The scripts run without cookies until consent is granted.
Other non-Google scripts continue to be blocked normally by automatic script blocking.
Choosing your default consent state
The default consent state depends on the Default Allow setting:
- Default Allow off (default): All consent parameters start as
denied. This is the standard opt-in model. Google services collect only anonymized data until consent is given. - Default Allow on: All consent parameters start as
granted. This is an opt-out model where tracking is active immediately and only stops if the visitor rejects cookies.
Saving your settings
Finally, click Save Changes at the bottom of the page.
Verifying your setup
Checking the default consent state
- Open your site in a private browser window (incognito mode).
- Open the browser developer tools (F12).
- Go to the Console tab and type
dataLayer. - Look for the consent entry. You’ll see default values set to
denied:
{
"ad_storage": "denied",
"analytics_storage": "denied",
"ad_user_data": "denied",
"ad_personalization": "denied",
"security_storage": "granted",
"functionality_storage": "granted",
"wait_for_update": 500
}
Checking the updated consent state
- Click Accept All on your consent banner.
- Check the
dataLayeragain in the console. You’ll see a new consentupdateentry with values set togranted.
Verifying GTM event firing
If you use Google Tag Manager, check for the wpconsent_consent_processed event in the dataLayer:
dataLayer.find(item => item.event === 'wpconsent_consent_processed')
This event includes the visitor’s preferences in wpconsentPreferences and can trigger tags in GTM.
Verifying with Google Tag Assistant
Use Google Tag Assistant to inspect your site. The assistant shows whether consent signals are being received and whether tags are firing in restricted or full mode.
Plugin compatibility
Google Consent Mode v2 works automatically with any method of adding Google scripts to your site:
- Google Tag Manager: Load GTM as usual. WPConsent sets the default consent state before GTM initializes and updates it when consent changes. Use the
wpconsent_consent_processeddataLayer event to trigger tags based on consent. - MonsterInsights: No configuration needed. WPConsent’s consent signals apply to the Google Analytics tag that MonsterInsights outputs.
- WPCode: If you add Google Analytics or Google Ads snippets through WPCode, WPConsent manages consent for those tags automatically.
- Google Site Kit: If Google Site Kit has its own consent mode enabled, WPConsent detects this and doesn’t output duplicate default consent scripts. Only 1 consent mode implementation runs at a time.
- PixelYourSite: WPConsent disables PixelYourSite’s built-in Google Consent Mode when WPConsent’s consent mode is active, preventing conflicts.
Troubleshooting
Google Consent Mode script isn’t loading
Check if the banner is enabled. Google Consent Mode only loads when the consent banner is active. Verify that Consent Banner is toggled on in WPConsent >> Settings.
Check for Google services. Go to WPConsent >> Settings and confirm at least 1 service slug contains “google.” If none exist, run a scan.
Clear the cache. WPConsent caches the Google service detection result. Go to WPConsent >> Tools and click Clear Cache in the Database section to refresh the wpconsent_needs_google_consent transient.
Check for Google Site Kit. If you use Google Site Kit with its own consent mode enabled, WPConsent defers to Site Kit and doesn’t output its own default consent script. This is expected behavior, not an error.
Google scripts are still being blocked
Verify that Google Consent Mode is enabled in WPConsent >> Settings. When active, WPConsent automatically skips blocking for google-analytics, google-tag-manager, and google-ads.
If scripts are still blocked, confirm the service names in your cookie database match these exact slugs. Custom or renamed services aren’t recognized by the skip logic.
Consent state not updating after banner interaction
Open the browser console and look for JavaScript errors. Then verify the consent update fires by listening for the event before clicking the banner:
window.addEventListener('wpconsent_consent_saved', (e) => console.log('Consent saved:', e.detail));
Next, click Accept All and check whether the event fires with the expected preferences.
Duplicate consent mode scripts
If you see 2 gtag('consent', 'default', ...) calls in your page source, another plugin may also be implementing Google Consent Mode. Check for conflicts with:
- Google Site Kit (WPConsent automatically detects and defers to it)
- PixelYourSite (WPConsent automatically disables its consent mode)
- Other consent plugins that may have their own Consent Mode implementation
To resolve this, disable the duplicate implementation in the other plugin.
FAQ
Do I need to modify my Google tag setup for this to work?
No. WPConsent handles the consent signals automatically, regardless of how you added Google scripts to your site. It works with WPCode, MonsterInsights, Google Tag Manager, or any other method.
Why aren’t my Google scripts being blocked when script blocking is on?
When Google Consent Mode is enabled, WPConsent intentionally skips blocking for Google Analytics, Google Tag Manager, and Google Ads. These scripts load in a restricted, cookieless mode and rely on Google’s own consent API instead of script blocking.
Can I use Google Consent Mode with an opt-out setup?
Yes. If you enable the Default Allow setting, all consent parameters start as granted. Tracking is active immediately and only stops when a visitor rejects cookies. This is the opt-out model.
How do I know if Google Site Kit is handling consent mode instead of WPConsent?
If Google Site Kit has its own consent mode enabled, WPConsent detects this automatically and doesn’t output a duplicate default consent script. You can verify by checking your page source for a single gtag('consent', 'default', ...) call.
How do I switch between simple mode and advanced mode?
To use advanced mode, enable the Google Consent Mode toggle in WPConsent >> Settings. This is the default. To switch to simple mode, disable the Google Consent Mode toggle and make sure Automatic Script Blocking is enabled. In simple mode, Google scripts are completely blocked until consent instead of running in a restricted state.
Conclusion
Google Consent Mode v2 lets your Google services collect anonymized data while respecting visitor privacy choices. WPConsent handles the entire integration automatically, from setting the default denied state to updating consent when visitors interact with your banner.
To learn how to fire specific GTM tags based on consent signals, see the guide on triggering GTM tags based on consent.