Skip to main content
Google Consent Mode v2 lets you communicate your visitors’ consent choices to Google tags (Analytics, Ads, etc.). When integrated with Katla, consent decisions automatically update Google’s consent parameters - no manual gtag calls needed. Consent Mode passes on the choices your banner collects. It does not decide what your site has to ask for: you are responsible for obtaining your visitors’ consent, and Google suggests consulting your legal department on the setup that fits your business. Google’s consent mode overview explains the feature in full, and Google’s documentation at the end of this page lists the guides behind each section.

How it works

Katla sets the four consent types Google tags read. Each is described below in Google’s words, with the Katla category that sets it: When a visitor grants or denies a category, the matching consent types are set to 'granted' or 'denied'. Katla does not set Google’s optional functionality_storage, personalization_storage or security_storage types, so Katla’s functional and personalization categories have no Consent Mode equivalent. Google describes two ways to implement Consent Mode, basic and advanced, and Katla supports both. Google’s About consent mode compares them: In basic mode, in Google’s words, “you prevent Google tags from loading until a user interacts with a consent banner.” With Katla, your Google tag loads only once the visitor allows the matching category. In advanced mode, “Google tags load when a user opens the website or app.” Katla declares every consent type denied by default (unless you set regional defaults), and while consent is denied Google tags send cookieless pings instead of writing cookies. Google lists what those pings can contain: functional information such as a timestamp, the user agent and the referrer, and aggregate, non-identifying information such as the consent state, whether ad-click information was in the URL, and a random number generated on each page load. “Only when a user grants consent to data collection, Google tags send the full measurement data.”

Which one to pick

The difference is what Google receives before consent, and how detailed its modelling can be. Basic mode sends nothing until the visitor consents. Advanced mode sends cookieless pings, which give Google’s conversion and behavioural modelling more to work from. Katla works the same way with both, and katla.app itself runs basic mode. Which one suits your site is your decision, and Google suggests making it with your legal department.

Basic mode: gate your own tag

Katla signals consent either way. Basic mode is about your tag, so it is your embed that changes: load it from the consent state rather than on page load.
Leave Google Consent Mode enabled in your widget settings alongside this. The default is still declared before your tag can initialise, a returning visitor who accepted gets their granted update straight after it, and the update calls keep working for tags you load later. onConsentChange is a single callback slot rather than an event emitter, which is why the snippet keeps whatever was there and calls it first.

Basic mode in React

Do not declare a Consent Mode default of your own in either case. The widget declares it before your tag loads, and a second default arriving after Google’s tags have read the first can clobber it and re-deny a visitor who had already accepted.
Withdrawing consent stops further events, but it cannot unload a tag that is already running in the current page - nothing can. The next page load starts clean.

Advanced mode: keep your tag as it is

Advanced mode needs no change to your Google tag. Put the Katla loader first in the <head>, keep your Google tag or Google Tag Manager snippet after it, and leave Google Consent Mode enabled in your site settings. Katla declares the default before your tag initialises and sends an update when the visitor chooses. The steps are in Widget setup below, or use the Google Tag Manager template if your tags live in Google Tag Manager.

Widget setup

If you use the Katla widget (the <script> tag embed), enable Google Consent Mode in your site’s widget settings:
  1. Go to your site’s Widget Settings page
  2. Set Google Consent Mode to Enabled
  3. Save changes
The loader then declares the default consent state, and the widget calls gtag('consent', 'update', ...) when the visitor accepts or rejects categories.

Use the loader, not the single-language script

The consent default is declared by the loader at {siteId}.js, not by the engine it pulls in:
Put it first in the <head>, ahead of your Google tag or Google Tag Manager snippet, and leave out async and defer. With either one the browser runs the loader later, usually after your Google tag has started, and Google records the default as late. This matters more than it looks. The loader is a few hundred bytes and runs the moment it is parsed, so the default is declared before your Google tag initialises. The script it pulls in is around a hundred kilobytes and is deferred - on a real connection gtag.js routinely finishes first. Declaring consent from inside that script means Google has already initialised with its own implicit defaults, which it records as wasSetLate and which makes the first hits of a page view count as consented. You can verify either way with the free Consent Mode checker.

Inline it to skip the request

A linked loader without async or defer keeps the order right, but the page waits while the browser opens a connection to another origin to fetch it. Pasting the loader into <head> removes the request, so the default is declared during parsing and nothing waits for it. Copy it from Install → Widget → Inline in your dashboard. Re-copy after changing your Consent Mode setting - a pasted copy is frozen.
This is the URL you already have in your page - {siteId}.js became the loader so that existing installs pick this up without being edited. If the tag in your page has async or defer, remove it: that is the one edit an older install needs. The engine it pulls in still declares a default of its own when the loader has not already, so nothing regresses if you reach it directly.

Forcing a language

Pass locale to the loader to skip language detection:
Useful when you serve one market, or when your own routing already knows the visitor. An unrecognised value resolves to the closest language we publish, and to English if there is no such language.

What the default contains

All four Consent Mode v2 signals, plus a wait window:
wait_for_update is Google’s setting for banners that load asynchronously: “specify wait_for_update along with a millisecond value to control how long to wait before data is sent” (Google’s setup guide). Katla uses 500 milliseconds. The default is the same for every visitor, returning ones included. For a returning visitor the loader then reads their stored choice from the consent cookie and sends it straight away as an update, so their first page view is measured with the consent they already gave rather than a blanket deny they have to re-answer:
Google asks consent platforms to leave the default unchanged after a visitor consents and to communicate their choice with the update, which is why the stored choice is never the default. Right after the default, the loader sets Katla’s developer ID from Google’s CMP Partner Program, so Google can attribute the consent signals to Katla:
The consent script sets it again when it loads, so a Katla tag added to Google Tag Manager before the developer ID existed sends it too.

Measuring where the CCPA banner shows

The CCPA banner is opt-out: cookies are allowed until the visitor opts out. With every signal denied by default, Google tags would still run cookieless for every visitor who never opts out. To let them measure, turn on Site settings → Google Consent Mode → Let Google tags measure where the CCPA banner shows in the dashboard (or the banner settings in the Shopify app). Which visitors that covers follows your Compliance setting: A visitor who opts out sends an update that denies all four, as before, and so does a returning visitor whose stored choice is an opt-out.

Regional defaults

For exceptions, open Advanced: regional defaults under the same card. To start Google tags from a different default in some regions, add rows there. Each row names one or more ISO 3166-2 codes, such as US, US-CA or SE, with its own analytics and advertising default. A row takes precedence over the switch above for the regions it names. The loader declares each row ahead of the global default:
Google’s region parameter sets “default consent states that apply to visitors from particular areas”, and when two defaults match, “the one with a more specific region will take effect” (region-specific behavior). So a US-CA row overrides a US row in California. A visitor’s own choice still replaces whichever default applied. A row only grants where the banner lets those cookies through before a choice: Anywhere else the row is declared denied, which is what the global default would have given. Telling Google granted where the banner blocks the cookies would have Google tags measure with cookies they cannot keep, so every page view would look like a new visitor. The dashboard shows which regions of a row are affected before you save. Auto picks the banner from the visitor’s time zone, and Google picks the region from their IP address. They agree for nearly every visitor; someone travelling, or on a VPN, can get one region’s default and another region’s banner. If you installed with the Google Tag Manager template, set regional defaults on the template tag instead. The template declares its own defaults, and the dashboard rows do not apply to a GTM install. If you pasted the loader into your page rather than linking it, copy it again after changing the rows: a pasted copy keeps the rows it was copied with.

Meeting Google’s banner requirements

Google asks consent platforms in its CMP Partner Program to offer a banner that explains that data is collected for personalized advertising purposes, links to business.safety.google/privacy, and includes an affirmative consent option. Google’s EU user consent policy and its help page on obtaining user consent describe what sites using Google’s products need from their banner. The Katla banner covers all three once Google’s banner text is on: To set it up:
  1. Turn on Site settings → Google Consent Mode in the dashboard (or the banner settings in the Shopify app).
  2. Check that Google’s banner text is on beneath it. It is on for new sites, and the dashboard marks it as recommended.
  3. Add your privacy policy and cookie policy links on the Banner page, so they sit beside Google’s link.
The sentence and link are translated into every language the banner supports. On a site with no marketing or personalization cookies, the sentence mentions analytics only, as the banner’s own description does. New sites start with Google’s banner text on. On a site added before that, it stays off until you turn it on. Turn it off on a site that uses no Google tags: naming Google in its banner would be untrue. It shows only while Consent Mode is on, and only on the GDPR banner: the CCPA banner does not include it.

Google Tag Manager template settings

If you install Katla with the Google Tag Manager template, the tag has its own Consent Mode settings. Each one is a Google setting, described here as Google’s setup guide describes it: The template declares its own defaults, so the dashboard’s regional defaults do not apply to a GTM install. Google’s banner text is a banner setting and works the same with the template.

React setup

If you use the @katla.app/sdk React integration, add the <GoogleConsentMode /> component alongside your existing setup:
The component:
  • Sets gtag('consent', 'default', ...) on mount with all parameters denied, then sends an existing choice as gtag('consent', 'update', ...)
  • Listens for katla:consent events and calls gtag('consent', 'update', ...) automatically
  • Cleans up the event listener on unmount

Vanilla JavaScript setup

For non-React apps using the SDK directly:
setupGoogleConsentMode() returns a cleanup function that removes the consent change listener. Every gtag('consent', 'update', ...) Katla sends is followed by a plain dataLayer event carrying the same state:
Google’s own tags follow a consent update by themselves. Other tags in a tag manager do not: a consent command has no event name, so no trigger can fire on it, and a tag that was held back while consent was denied waits for the next page view. The page it misses is the one your visitor landed on. In Google Tag Manager, create a Custom Event trigger named consent_update and a Data Layer Variable for the signal a tag depends on, such as consent_state.ad_storage. Fire the tag when that variable equals granted. The event is sent whenever an update is:
  • On a choice. When a visitor accepts, rejects or changes their categories. A refusal sends it too, with every value denied.
  • On page load, for a returning visitor. Every install declares a denied default and replays the stored choice as an update, so the event follows on every page view after the first choice.
The widget sends the event from guard script version 4 (KatlaConsent.version). A self-hosted copy of the engine replays a stored choice as an update from version 5, and declares regional defaults and the developer ID from version 6.

CCPA banner behavior

With Compliance set to US State Laws (CCPA), or to Auto for visitors it shows the CCPA banner, the banner offers an opt-out of the sale or sharing of personal information instead of a choice per category. The default is the same denied default as on the GDPR banner. A visitor who opts out gets this update: After an opt-out the banner allows only functional cookies, so all four consent types are denied, as they are after Reject on the GDPR banner. See CCPA for how the opt-out works. The dashboard checks Google Consent Mode across your landing pages for you. Open your site and choose Google Consent Mode under Setup. Each page is loaded the way a first-time visitor sees it, and again after accepting the banner, and graded on the same four checks as the free Consent Mode checker: The report lists every page with its result, what failed and how to fix it. When a page’s Google tag is served from your own domain, the report says so: that usually means Google tag gateway.
  • When it runs. Automatically, so you do not need to start it. On plans with automatic scans, it runs after every one of them. On every plan, Free included, it also runs at least once a month, whether or not you scan. Automatic checks run in the small hours, UTC. It also runs after every scan you start and whenever you press Check now. The report shows when the next automatic check is due.
  • Which pages. The pages your last scan found: the homepage first, then your priority pages, then the rest.
  • How many pages. Up to 5 on the Free plan, and up to 25 on paid plans.
  • Email when something breaks. When a check finds a gap the previous one did not, the team’s owners and admins get an email listing the pages and what failed on each. A gap that was already there is not emailed again. While Google Consent Mode is off for the site, the automatic check is paused and no email goes out.
  • A late default. The report and the email both send you to Google tags read consent before the default, which starts by checking whether the tag is served through Google tag gateway, or straight to Google tag gateway when the tag loads from your own domain.

Debug mode

Add debug=true to the Katla script while you set up, and Katla checks your Consent Mode setup on every page load:
Katla logs each consent decision and every cookie it blocks to the browser console. A second after the page has loaded, it also checks whether the Consent Mode default was declared before any Google tag read consent, and shows the answer in the console and in a small panel in the bottom-left corner of the page: The verdict comes from Google’s own record of the page (google_tag_data.ics.wasSetLate), the same signal Tag Assistant reports. Google’s Troubleshoot consent mode with Tag Assistant covers the same checks from Google’s side. When a Google tag loads from your own domain rather than Google’s, the panel says so: that usually means Google tag gateway. Remove debug=true when you are done, since visitors see the panel too. If you pasted the loader into your page, link the script instead while you debug. With the Google Tag Manager template, use the Consent tab in Tag Assistant or the Consent Mode checker. A Google tag reads the consent state when it first runs. If Katla’s default arrives after that, the tag has already sent its first hits as if consent had been given. Work through these in order, then reload with debug=true and check the panel again.
  1. Check whether the late tag is served through Google tag gateway. Open your browser’s developer tools, go to the Network tab and filter for gtag or gtm.js. If the tag loads from your own domain, for example https://example.com/a1b2/gtag/js?id=G-XXXXXXX, instead of from www.googletagmanager.com, it is served through Google tag gateway. Follow Google tag gateway below.
  2. Put the Katla script first in the head of the page, ahead of your Google tag or Google Tag Manager snippet, and without async or defer. The loader is small and declares the default as soon as it is parsed. If a plugin, theme or tag manager adds the Katla script for you, add it to the page itself instead.
  3. On Google Tag Manager, use the Katla template on the Consent Initialization - All Pages trigger rather than a Custom HTML tag, which runs too late. See the template’s setup steps.

Google tag gateway

Google tag gateway for advertisers serves your Google tag from your own domain, through a CDN such as Cloudflare or a load balancer, under a path you choose called the measurement path. Consent works the same way through the gateway: Katla’s default still has to run before the tag reads consent. What changes is who puts the tag in your pages, and so who controls the order the scripts load in.
  • One-click CDN setup often takes the load order out of your hands. With automated setup, for example Cloudflare set up from your Google tag or Google Tag Manager, the CDN changes your pages as they are served: it replaces your Google tag with its first-party version, and can insert the tag on domains that had none. Where the CDN puts the tag is not decided by your page source, and a tag inserted ahead of the Katla script reads consent before Katla’s default exists. This is the most common cause of a late consent signal with the gateway. Google’s Cloudflare guides say to turn off automated script setup if you use consent mode: see setup in the Google tag and setup in Google Tag Manager.
  • Manual setup leaves the load order with you. With manual setup you point your Google tag or Tag Manager snippet at your measurement path yourself, so it loads where you put it, after the Katla script.

Check whether a tag is enrolled in the gateway

Any one of these tells you:
  1. Google tag settings. In your Google tag settings, or under Admin in Google Tag Manager, open Google tag gateway. Each domain shows a status: First-party means the gateway is active, Pending means it is enabled but Google has no diagnostic information yet, and Paused or Not started mean it is not serving the tag.
  2. Network tab. In your browser’s developer tools, filter the Network tab for gtag or gtm.js. An enrolled tag loads from your own domain, such as https://example.com/a1b2/gtag/js?id=G-XXXXXXX, instead of from www.googletagmanager.com. The CDN changes pages on their way out, so check the live site with View Source or the Elements panel, not your own source files.
  3. Tag Assistant. Summary → Output → Hits Sent shows the hits routed to your measurement path.
  4. Katla’s debug mode. With debug=true, the panel says when the Google tag loads from your own domain.
If the consent signal is late and the tag is enrolled in the gateway, Google recommends advanced consent mode (U+C) for tags served through the gateway, because it works with manual gateway setup as well as automated setup. Pick the route that fits your site:
  1. Use advanced consent mode with global consent defaults and data transmission controls. Keep the Google tag loading as it does, with Katla’s default and updates in place, and in your Google tag settings:
    • Turn on the consent mode override, the global consent defaults, for the regions where your banner asks for consent. In Google’s words it can help “if your existing default consent commands don’t take effect before your Google tags load”, because it sets the default to denied for those regions whatever the page code does. It applies to one Google tag, so set it on each Google tag on the site.
    • Set data transmission controls according to your needs. They let you limit advertising, behavioral analytics and diagnostics data separately while consent is denied.
  2. Move your Google tags into one Google Tag Manager container and deploy it through the gateway. Install Katla with the Google Tag Manager template on the Consent Initialization - All Pages trigger. The template declares the default inside the container before any other tag runs, wherever gtm.js is served from.
  3. Set the gateway up manually, so you control the script order: the Katla script first in the <head>, then your Google tag or Tag Manager snippet pointing at your measurement path. Turn off automated script setup in the CDN, and do not have it add the tag to untagged domains.
Then reload with debug=true: the panel should say Consent Mode is set before your Google tags.

Verification

Use Google Tag Assistant to verify that consent signals are being sent correctly:
  1. Install the Tag Assistant browser extension
  2. Load your page with Katla and Google Analytics/Ads
  3. Check the Consent tab - you should see a default event with all parameters set to denied
  4. Accept cookies in the Katla widget
  5. Verify an update event appears with the appropriate parameters set to granted
Google’s Troubleshoot consent mode with Tag Assistant walks through the same checks in more detail.

Getting help

Start with Katla support, not Google, when something is wrong with Consent Mode on your site: missing or wrong consent signals on your Google tags, a default that arrives late, the Google Tag Manager template, or the banner itself. Google’s own support asks for proof that you contacted your consent platform first.
  • Email consentmode@katla.app for Consent Mode and Google tag questions, or support@katla.app for anything else, or use the form at katla.app/contact.
  • Response time. We reply within one business day, Monday to Friday, 09:00-17:00 CET, on every plan.
  • A real first reply. The first reply is a technical answer from someone who has looked at your site: what we found and the next step to fix it, not a note saying we will get back to you.
  • What to include. The site and the page, and either the result from the Consent Mode report or a screenshot of the debug mode panel with debug=true. If the Google tag is served through Google tag gateway, say how it was set up.

Google’s documentation

Google’s own guides to Consent Mode, which the sections above follow: