Consent Mode with gtag
This page explains how the banner handles Google Consent Mode on a site with gtag.js and without Google Tag Manager. It shows who sends default and update, and how to get Basic or Advanced.
Who this is for
For you if you have the Google tag (gtag.js) in the page code. With Google Tag Manager, see With Google Tag Manager.
Prerequisites
Before you start, check that:
- the banner snippet is on the page. See HTML snippet;
- Google Consent Mode is on in the web space. New web spaces already have it on. In Cookie Banner > Advanced settings, the Support for Google Consent Mode dropdown shows Activate.
Who sends what
| Command | Who sends it | When |
|---|---|---|
gtag('consent', 'default', …) | the banner snippet, at the top, synchronously | before every Google tag the page loads after the snippet |
gtag('consent', 'update', …) | the banner | when the visitor chooses, and when it loads a consent already saved |
{ event: 'avacy_consent_update' } | the banner | right after the update |
The default
The snippet sends a single global default. All seven consent types (ad_storage, ad_user_data, ad_personalization, analytics_storage, functionality_storage, personalization_storage, security_storage) start as denied. wait_for_update is 500 ms.
The snippet does not send its default in two cases:
- the page already has a
consent defaultin thedataLayer; - the page has the Avacy GTM template, which sets the default on its own.
Add your own consent default only if you want different values (see Wait times).
The updates
The banner sends the update with the seven types set to granted or denied, based on the visitor's choices. A type without a choice stays denied.
Right after the update, the banner pushes the avacy_consent_update event to the dataLayer, with no other data. The event is for Google Tag Manager tags that are not Google tags. The order is always update, then event. The event also fires with a consent already saved.
Basic and Advanced
The banner has no Basic or Advanced switch. The mode depends on how the page loads the Google tags.
According to Google, in Basic mode Google tags do not load until the visitor interacts with the banner. In Advanced mode they load when the page opens, with the consent defaults (source).
| Mode | What the page does | What the banner does |
|---|---|---|
| Advanced | The Google tag loads immediately, after the snippet. | Sends the default before the tag, then the updates. |
| Basic | The Google tag is marked and stays on hold. | Unblocks the marked scripts after the update, when the required consent is granted. |
Advanced
- Put the banner snippet in the
<head>, near the top, before the Google tag. - Leave the Google tag as it is, without marking it.
<head>
<!-- 1. Banner snippet, first -->
<script src="https://TENANT.avacy-cdn.com/v3/avacy-cmp-web.js?webspace=WEB-SPACE-UUID"></script>
<!-- 2. Google tag, as usual -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
</head>
Replace TENANT, WEB-SPACE-UUID and G-XXXXXXXXXX with your values. Copy the real snippet from the dashboard.
Basic
Mark the Google tags so they stay on hold until consent. Steps, example and the table of purpose numbers are in Google tags with gtag, without GTM.
Wait times (wait_for_update)
wait_for_update is the time, in milliseconds, that Google tags wait for an update before using the default.
| Who sends the default | Value |
|---|---|
| Banner snippet | 500 ms, fixed |
| Avacy CMP GTM template | Wait for update field, default 2000 ms, editable |
The snippet value cannot be configured. For a different value, send your own consent default before the snippet. The snippet then does not send its own.
With Google Tag Manager
The Avacy CMP GTM template sends the default, including per region, with the values chosen in the tag. It marks the page with __AVACY_GTM_CONSENT_TEMPLATE__, and the banner sends only the updates. The template guide is Install the banner with Google Tag Manager (in Italian).
Verify
- In the browser console, run
dataLayer.map(e => e.event || e[0] + ' ' + e[1]). - Check that
consent defaultappears beforejsandconfig. - Make a choice in the banner and run the command again.
consent updatemust appear, followed byavacy_consent_update. - Turn on debug mode and check the result. See Google tag order and debug mode.
Common problems
The most frequent problems:
- The console reports
LATE: a Google tag ran before the default. Put the snippet before the tag. If the tag goes through Google Tag Gateway, see Google Tag Gateway; - All types stay
deniedafter accepting: check which button was pressed. The X at the top (Continue without accepting) and Reject all set all types todenied. Accept cookies sets them all togranted; - The
defaultis not in thedataLayer: the page may use adataLayerwith a different name. The banner reads onlydataLayer.
Last updated: 10/11/2026.