Consent Mode Default States, Regions and wait_for_update: Fixing Tag Race Conditions
The Bug That Looks Like a Revenue Problem
A very common Consent Mode failure is not a missing banner but a race condition: Google tags load, read their consent state, and make their first request before the CMP has told them what the visitor chose. The result is hits sent with the wrong state, or consent updates that arrive after the data has already been counted as denied.
The Three Moving Parts
- Default state — set with
gtag('consent', 'default', {...}). It defines what is assumed before any user choice exists. - Update — set with
gtag('consent', 'update', {...})when the visitor chooses or when stored consent is read. - wait_for_update — a millisecond value on the default command that tells Google tags to wait for an update before sending their first measurement.
A Safe Default Block
The default command must run before any Google tag loads. A typical pattern sets ad_storage, analytics_storage, ad_user_data and ad_personalization to denied, and adds a short wait_for_update, for example 500 milliseconds. Pick a value long enough for your CMP to load and read stored choices, but short enough that slow loads do not delay measurement too much.
Using the region Parameter
The default command can be limited to specific regions with the region parameter, using ISO 3166 country or subdivision codes. You can issue several default commands: one with denied values for regions where you want opt-in, and a general one for the rest. More specific regions take precedence over broader ones. Keep your region list in one shared snippet so it does not drift between sites.
Return Visitors
The most overlooked case is a visitor who already made a choice. Your CMP must call update as early as possible on page load with the stored values. If the update is slower than your wait_for_update value, the first hit goes out as denied. Measure how long your CMP takes to apply stored consent and set the wait accordingly.
Step-by-Step Test Procedure
- Open a clean browser profile with DevTools and the Network tab, preserving logs.
- Load the page and find the first request to a Google endpoint. Read its
gcsandgcdparameters. - Accept in the banner. Confirm an update is sent and later hits show granted values.
- Reload. The very first hit should already carry the stored state.
- Repeat with reject, then with a region where your default is granted.
- Use Tag Assistant to view the consent state at each event.
Typical Failures and Fixes
- Default set after the tag. Move the snippet above the GTM or gtag loader.
- Two defaults conflicting. Remove duplicate commands from themes, plugins and tag containers.
- Update never fires on return visits. Check that the CMP applies stored consent without waiting for the banner to render.
- SPA navigation. Confirm that route changes do not reset the state.
- Hardcoded “granted” for testing left in production.
How FlexyConsent Helps
FlexyConsent supports Google Consent Mode v2 and is a Google-certified CMP (CMP ID 317). Placing the script high in the head lets it set defaults and send updates in the correct order, and the banner is available in 58 languages.
Key Takeaways
- Default state must run before any Google tag.
- wait_for_update gives the CMP time to deliver the real choice.
- Use region parameters for different defaults, with one shared snippet.
- Return visitors need a fast, early update call.
- Always verify with the gcs parameter and Tag Assistant in a clean profile.