Don't have one? Create one ↗
← All courses
Lessons in this module

Lesson 14 of 16

Regions And Wait_For_Update

① Connect your GTM container

Paste your container ID to load it into this page. It only ever runs here.

Advanced: use a specific environment

One default does not fit the whole planet. GDPR wants everything denied in the EEA, California is an ad-signals opt-out story, and much of the world needs no gate at all. Consent Mode handles this with region-scoped defaults: you call gtag('consent', 'default', ...) several times, each with a region array of country (or country-subdivision, like US-CA) codes, plus one region-less call as the everywhere-else fallback. The most specific match wins.

The second tool is wait_for_update: 500: it asks tags to hold their first hits up to 500 ms so a CMP that already knows the visitor's choice can deliver the update before anything is sent. Switch the visitor region below and watch the same page open three different ways.

Goal

Write region-scoped consent defaults with wait_for_update, and see how EEA, US-CA and everywhere-else visitors start differently.

Build it in GTM

  1. Extend your consent-default tag with regions

    Open your Custom HTML - Consent Default tag (from the defaults lesson, still on Consent Initialization) and make it three calls, strictest first:

    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      // EEA: everything denied
      gtag('consent', 'default', {
        ad_storage: 'denied', analytics_storage: 'denied',
        ad_user_data: 'denied', ad_personalization: 'denied',
        region: ['ES','DE','FR','IT','NL','BE','SE','PL','AT','IE'],
        wait_for_update: 500
      });
      // California: ad signals denied, analytics allowed
      gtag('consent', 'default', {
        ad_storage: 'denied', ad_user_data: 'denied',
        ad_personalization: 'denied', analytics_storage: 'granted',
        region: ['US-CA'],
        wait_for_update: 500
      });
      // Everywhere else
      gtag('consent', 'default', {
        ad_storage: 'granted', analytics_storage: 'granted',
        ad_user_data: 'granted', ad_personalization: 'granted'
      });
    </script>
  2. Understand the matching rules

    A more specific region beats a less specific one: US-CA beats a US rule, and any region rule beats the region-less fallback. Order in the code doesn't decide; specificity does. Google reads the visitor's region from the request, you never detect it yourself.
  3. Give the CMP its window

    Keep wait_for_update: 500 on the denied defaults. Returning visitors whose choice is already stored get it re-applied inside that window, so their very first hits carry the right consent instead of being modeled unnecessarily.

Debug in Tag Assistant

Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

In Tag Assistant's Consent tab the On-page default column reflects whichever regional rule matched your location. You can't hop continents to test the rest, which is exactly why this page simulates all three timelines for you.

Verify your container

Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.

Drop your container .json here

or browse · checked in your browser, nothing is uploaded

0 of 16 lessons complete
Was this lesson helpful?