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
Open the banner settings
Go to Cookie Banner, then Settings.
Tick Use Google Consent Mode
Under Google Consent Mode, tick Use Google Consent Mode.
Tick Google-ready banner text
Tick Google-ready banner text as well, so your banner shows the wording Google asks for.
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:
<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.
| Mode | Before the visitor consents |
|---|---|
| Advanced | Google tags load straight away. CookieScan tells them consent is denied, so they set no cookies and send cookieless pings. |
| Basic | Google 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
Open a Google tag's consent settings
In Tag Manager, open the tag. Under Advanced Settings, open Consent Settings.
Require additional consent
Choose Require additional consent for tag to fire.
Add the consent types it needs
Add
analytics_storagefor Google Analytics. Addad_storage,ad_user_dataandad_personalizationfor Google Ads and Floodlight.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.
Turn on the JavaScript API
Go to Cookie Banner, then Settings, tick Javascript API and select Save & Publish.
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.
<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
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.
Check the default
On the first event, open Consent. On-page Default shows denied, or your regional defaults.
Check nothing updates yet
No On-page Update appears until you select a button on your banner.
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.