Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Consent Mode default not set before tags load: how to fix it

TRK-285High impactPartlyBy FunnelGuardPublished Updated
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.

Wrong order versus right order
  1. Page starts loadingHTML is parsed
  2. Google tag / GTM loadsNo consent default exists yet
  3. Consent default setToo late for this page view
  4. 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.

What goes wrong when the default arrives late
  • 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.
Landing-page hits with a consent stateExample numbers
Landing-page hits with a consent state (example)Default loads late: 60 %; Default loads first: 100 %0387760100Default loads lateDefault loads first%

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

Check the order in your browser
  1. Open the page in a private window

    Use a fresh session so no saved consent choice is applied.

  2. 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.

  3. Inspect dataLayer in the Console

    Type dataLayer and expand it. The first entries should include a consent default command, before gtm.js or the config command.

  4. Use GTM Preview modeGoogle Tag Manager

    In Tag Assistant, the consent default should appear at Consent Initialization, before Container Loaded and Page View.

  5. Check the gcd parameter

    Filter Network for collect or google-analytics. Look for gcd= 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.

Default first, then the Google taghtml
<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>
Fix by platform
  1. 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.

  2. Turn on consent overview

    In Admin, open Container Settings and enable Enable consent overview. Check that tags have the right built-in consent checks.

  3. Remove duplicate defaults

    Make sure only one default is set per region, or the later one may override your intended state.

Tag order

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

Verify the fix
  1. Reload in a private window

    Clear cookies, load a landing page and open DevTools before the banner appears.

  2. Read dataLayer order

    The consent default should be the first command, ahead of gtm.js or config.

  3. Check gcd on the first request

    The first collect request should include a gcd value that reflects your default.

  4. Accept, then check the update

    After clicking Accept, a consent update should appear and later requests should show a changed gcd.

  5. 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

Habits that keep the order right
  • 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.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: gcd parsed; ordering not checked.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.