On this page
What this issue is
Google Consent Mode lets your tags adjust their behaviour based on what the visitor agreed to. It works with two commands. The default command sets the starting state, for example ad_storage: denied. The update command runs after the visitor makes a choice in your cookie banner.
Order matters. The default command must run before the Google tag, the Google Tag Manager (GTM) container, or any Google Ads or GA4 tag. If it runs after, the tags have already started with no consent information. Google tags read the consent state when they load, so a late default is ignored for that first page view.
A common cause is a cookie banner script that sets the default itself, but loads late, async or from inside GTM on the normal All Pages trigger.
- Page starts loadingHTML is parsed
- Google tag / GTM loadsNo consent default exists yet
- Consent default setToo late for this page view
- Hits sentWrong or missing consent signals
The break is the tag starting before a consent default exists.
Why it costs you leads or sales
There are two risks, and they point in opposite directions.
- Tags may treat the visitor as granted and send ad data before any choice, which is a privacy risk for EU and UK traffic.
- Hits may go out with no consent state, so Google Ads and GA4 cannot model or attribute them properly.
- The first page view of a session, often the landing page with the gclid, is the one most likely to be affected.
- Conversions and audiences shrink or look inconsistent, so bidding learns from poor data.
- Reports differ between browsers and visits because the race between scripts changes each time.
Example: share of first page views that carry a consent state, before and after moving the default above the tag. Numbers are illustrative.
How to check if your site has it
Open the page in a private window
Use a fresh session so no saved consent choice is applied.
View the source or the Network tab
Open DevTools, go to Network, reload, and note when the googletagmanager.com request happens compared with the consent default script.
Inspect dataLayer in the Console
Type
dataLayerand expand it. The first entries should include aconsentdefaultcommand, beforegtm.jsor theconfigcommand.Use GTM Preview modeGoogle Tag Manager
In Tag Assistant, the consent default should appear at Consent Initialization, before Container Loaded and Page View.
Check the gcd parameter
Filter Network for
collectorgoogle-analytics. Look forgcd=in the request. If it is missing, no consent state was attached.
How to fix it
The rule is the same everywhere: set the default first, then load tags, then send an update when the visitor chooses. Use denied defaults for regions where you need opt-in consent.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 500
});
</script>
<!-- Google tag or GTM snippet goes AFTER this -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>Move the default to Consent Initialization
Create or edit the consent default tag (a CMP template or a Custom HTML tag with the gtag code). Set its trigger to Consent Initialization - All Pages so it runs before other tags.
Turn on consent overview
In Admin, open Container Settings and enable Enable consent overview. Check that tags have the right built-in consent checks.
Remove duplicate defaults
Make sure only one default is set per region, or the later one may override your intended state.
Check how the consent plugin loads
In your consent or Google tag plugin settings, enable the Consent Mode option and any setting about loading the default before other scripts. Names vary by plugin.
Disable caching or script delay for it
If a performance plugin delays or defers JavaScript, exclude the consent default script so it is not pushed after the Google tag.
Avoid a second hard-coded tag
Remove any Google tag pasted into the theme header if a plugin already adds it.
Use the Customer Privacy API
Use a consent app or Shopify's Customer Privacy settings that support Google Consent Mode, so the default is set when the page starts.
Check the Google & YouTube channel
If you use a pixel or a custom snippet in theme.liquid, make sure it comes after the consent default.
Put the default in Head code
In Site settings, open Custom code, and paste the default script at the top of Head code, above the GTM or Google tag snippet.
Publish and recheck
Custom code only applies on the published site, so test the live URL.
Place the default at the top of head
Put the inline default script above every script that loads Google tags. Do not load it async or from the CMP file if that file may arrive late.
Send the update from your banner
When the visitor accepts, call
gtag('consent','update',{...})with the granted values.
Before
- GTM snippet sits first in the head
- CMP loads async and sets the default later
- First hit has no consent state
After
- Inline default runs first
- GTM or Google tag loads next
- Banner choice sends an update
How to confirm it's fixed
Reload in a private window
Clear cookies, load a landing page and open DevTools before the banner appears.
Read dataLayer order
The consent default should be the first command, ahead of
gtm.jsorconfig.Check gcd on the first request
The first collect request should include a
gcdvalue that reflects your default.Accept, then check the update
After clicking Accept, a consent update should appear and later requests should show a changed
gcd.Repeat a few times
Reload five or more times, since this is a race and may fail only some of the time.
How to prevent it happening again
- Keep the default in one place only, and note where it lives.
- Re-test the order after any change to the CMP, theme, GTM container or performance plugin.
- Do not let script delay or defer settings touch the consent default.
- Use the Consent Initialization trigger for consent tags in GTM.
- Add a check to your release steps: first hit must carry
gcd.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. When the robot visitor runs your journey, it parses the gcd parameter on the tracking hits sent to Google. That tells you whether a consent state was attached and what it contained.
What it does not check is the ordering: it does not confirm that the default command ran before the Google tag loaded. A hit can carry a valid gcd and still come from a page where the sequence was wrong on another visit.
Cover the rest by hand. Inspect dataLayer and the Network tab as described above, use GTM Preview to confirm Consent Initialization comes first, and repeat the test several times. Run it again after every change to your banner, theme or container.
FunnelGuard has a Free plan (1 site, 2 journeys, daily checks, no card), and every paid plan has a 3-day free trial.
Questions people ask
Why is my Consent Mode default not working?
The most common reason is that the Google tag or GTM container loads before the default command, so tags start with no consent state. Move the default above the tag, or use the Consent Initialization trigger in Google Tag Manager.
Where should the gtag consent default code go?
Put it inline in the head, above the Google tag or GTM snippet. It must run before any tag that reads consent. Do not load it async or from a file that may arrive after the tag.
What is the Consent Initialization trigger in GTM?
It is a trigger that fires before All Pages and other triggers. Use it for the tag that sets your consent default, so the state exists before any measurement tag runs.
How do I check if the consent default runs before my tags?
Open DevTools, type dataLayer in the Console and check that the consent default is the first command, before gtm.js or config. In GTM Preview, it should appear before Container Loaded. Also look for gcd= on the first request.
What does the gcd parameter mean?
The gcd parameter appears on Google hits and encodes the consent state the tag saw. If it is missing, the tag likely had no consent information when it sent the hit.
Can a CMP set the default and still be too late?
Yes. If the banner script loads async, is delayed by a performance plugin, or runs from a normal GTM trigger, its default can arrive after Google tags have started. Check the order, not only that the CMP is installed.
Does FunnelGuard detect a late consent default?
Only partly. It parses the gcd parameter on tracking hits, but it does not check that the default ran before the tags loaded. You should confirm the order by hand in DevTools or GTM Preview.
Related issues
- TRK-282Consent banner shown but tags fire before any choiceFix guide
- TRK-284Consent Mode v2 not implemented (no gcs/gcd)Fix guide
- TRK-288Consent update never sent after AcceptFix guide
- TRK-289Consent defaults granted in EU (non-compliant)Fix guide
- TRK-291wait_for_update too short, tags fire denied though user acceptedFix guide
- TRK-296CMP script fails to load, blocking all tagsFix guide