Skip to content

EARN UP TO 50% COMMISSION WITH OUR RESELLER ACCOUNTS + REGULAR PASSIVE INCOME SIGN UP TODAY

Install CookieScan

Set up Google Consent Mode

Pass each visitor's choice on your cookie banner to Google tags with Google Consent Mode, using the CookieScan script or the Tag Manager template.

Updated 5 min read

Applies to:
  • Tag Manager & Consent Mode

https://cookiescan.com/help/set-up-google-consent-mode/ Β· Updated 12 October 2026

On this page

Before you start

Google Consent Mode tells Google tags, such as Google Analytics and Google Ads, whether a visitor has consented. CookieScan sends a default before the visitor chooses, then an update when they do. It works on every plan, with either install method.

New websites have Use Google Consent Mode turned on already. Consent Mode passes each visitor's choice to Google tags. On its own, it doesn't make a website meet any particular law.

Turn on Consent Mode in the Portal

  1. Open the banner settings

    Go to Cookie Banner, then Settings.

  2. Tick Use Google Consent Mode

    Under Google Consent Mode, tick Use Google Consent Mode.

  3. Tick Google-ready banner text

    Tick Google-ready banner text as well, so your banner shows the wording Google asks for.

  4. Save your settings

    Select Save & Publish.

With Consent Mode on, your banner always lists the Marketing and Statistics categories, even if your scan found no cookies in them. Visitors can then accept or refuse Google's advertising and analytics consent, through those two categories. Show Google-ready banner text explains the wording.

Connect your Google tags

How you connect your Google tags depends on how you installed CookieScan.

With Google Tag Manager

The CookieScan template sets the default and sends the updates. Put it on the Consent Initialization - All Pages trigger, as in Install with Google Tag Manager. Keep your Google tags on their usual triggers.

With the CookieScan script

Put the CookieScan script above your Google tag code in <head>. CookieScan sets the default as soon as it loads, so it has to run before any Google tag:

HTML
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>

If the order is wrong, your browser console shows a warning that starts [CookieScan] Google tags were initialised before CookieScan.

Choose advanced or basic

Consent Mode can run in two ways. Google explains both in its Consent Mode overview.

ModeBefore the visitor consents
AdvancedGoogle tags load straight away. CookieScan tells them consent is denied, so they set no cookies and send cookieless pings.
BasicGoogle tags don't load at all. Nothing is sent to Google until the visitor consents.

The setup above gives you advanced mode. Which mode to use is your decision. For basic mode, follow one of the next two sections as well.

Set up basic mode in Tag Manager

  1. Open a Google tag's consent settings

    In Tag Manager, open the tag. Under Advanced Settings, open Consent Settings.

  2. Require additional consent

    Choose Require additional consent for tag to fire.

  3. Add the consent types it needs

    Add analytics_storage for Google Analytics. Add ad_storage, ad_user_data and ad_personalization for Google Ads and Floodlight.

  4. Repeat for each Google tag

    Then publish your container.

Each tag then fires only once the visitor has granted those types.

Set up basic mode with the CookieScan script

With a script tag, you load the Google tag only after consent, using the JavaScript API.

  1. Turn on the JavaScript API

    Go to Cookie Banner, then Settings, tick Javascript API and select Save & Publish.

  2. Replace your Google tag code

    Keep the CookieScan script first in <head>. Replace your Google tag code with the code below, using your own tag ID.

HTML
<script>
  function loadGoogleTag() {
    if (window.googleTagLoaded) return;
    window.googleTagLoaded = true;
    var s = document.createElement('script');
    s.async = true;
    s.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX';
    document.head.appendChild(s);
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'G-XXXXXXX');
  }
  // A returning visitor who has already consented
  if (window.cookieScan && cookieScan.consentGiven && cookieScan.consent.statistics) {
    loadGoogleTag();
  }
  // A visitor who consents on this page
  document.addEventListener('cookiescan_consent_update', function (e) {
    if (e.detail.statistics) loadGoogleTag();
  });
</script>

For a Google Ads tag, check marketing in place of statistics. JavaScript API lists every value you can check.

Don't rely on Auto-block cookies alone for basic mode. Auto-blocking only holds back scripts from websites where your scan recorded optional cookies. Google Analytics sets its cookies on your own website, so Google's tag script is usually not held back.

Check it worked

  1. Open your website in Tag Assistant

    Use Preview in Tag Manager, or Google's Tag Assistant for a script tag install. Test as a new visitor: use a private window, or clear your website's cookies first.

  2. Check the default

    On the first event, open Consent. On-page Default shows denied, or your regional defaults.

  3. Check nothing updates yet

    No On-page Update appears until you select a button on your banner.

  4. Check basic mode, if you use it

    Your browser sends no Google tag requests before you consent.

To see each command CookieScan sends, add ?cookiescan_debug=1 to a page address and open your browser's console. Google's guide to troubleshooting Consent Mode has more checks.

Next steps

Was this article helpful?

Thanks for your feedback.

Please don't include personal details. We can't reply here.

Thanks for your feedback.

Please don't include personal details. We can't reply here.

Thanks, your comment has been sent.

Sorry, we couldn't record your feedback. Please try again later.

Still stuck?

Our support team can help with anything these guides don't cover. Tell us your CookieScan ID and the page address so we can look straight away.

Back to Install CookieScan