<aside> 💡 If you want to learn about what Google Consent Mode is and why it’s important, you can find more information including a video here.

</aside>

1 . Ensure Google Tag Manager and the Google Services appear on your Cookie Banner

Our cookie banner is created by the Cookies section which relies on your Personal Data Inventory. You can view this by going into Cookie Banner > Cookies.

2. Enabled Google Consent Mode on the Privasee Platform

Go to Cookie Banner > Settings > Google Consent Mode, ensure the toggle is on and press Save Changes.

3. Configuring your Cookie Banner

The following code must be added to the top of the <head> section of your website.

  1. Add the CMP Script

    <!-- Add the Privasee Cookie Banner, insert your company id in "XXXXXXXXX" -->
    <script id="privasee-cb" src="<https://app.privasee.io/cdn/XXXXXXXXX/cookie-banner.js>"></script>
    
  2. (optional) If Smart Data Protector is enabled. Add the Smart Data Protector snippet, this will be the next script to place inline just after the CMP script.

    <!-- If Smart Cookie Blocker is enabled, add the script to load it -->
    <link rel="preload" href="//privacy-proxy.usercentrics.eu/latest/uc-block.bundle.js" as="script" />
    
    <script
    	type="application/javascript" 
    	id="uc-block" 
    	src="<https://privacy-proxy.usercentrics.eu/latest/uc-block.bundle.js>">
    </script>
    
  3. Add the data layer and configure Gtag as per Google Developers consent mode documentation.

    <script type="text/javascript">
    	// create dataLayer
    	window.dataLayer = window.dataLayer || []; function gtag() {
    	  dataLayer.push(arguments);
    	}
    
    	// set "denied" as default for both ad and analytics storage.
    	gtag("consent", "default", {
    		ad_user_data: "denied",
    		ad_personalization: "denied",
    		ad_storage: "denied",
    		analytics_storage: "denied",
    		wait_for_update: 500 // milliseconds to wait for update
    	});
    
    	// Enable ads data redaction by default
    	gtag("set", "ads_data_redaction", true); 
    
    	// Disable url passthrough so information is not sent without consent.
    	gtag('set', 'url_passthrough', false);
    </script>
    
  4. (optional) If the Smart Cookie Blocker is enabled. Unblock Google Tag Manager (with templateId BJ59EidsWQ from the Smart Cookie Blocker. We need to prevent the CMP from blocking the Google Tag Manager to ensure Google Consent Mode signals are sent.

    <!-- If Smart Cookie Blocker is enabled, unblock Google Tag Manager before user consent. -->
    <script>
    	uc.deactivateBlocking([
    		'BJ59EidsWQ', // GTM templateId is not blocked
       ]);
    </script>
    
  5. Add the rest of the Google Tag Manager Script

    <aside> ⚠️ Remember to replace “GTM-XXXXXXX” with your Google Tag Manager ID below.

    </aside>

    <!-- Add Google Tag Manager (GTM Script) -->
    <script type="text/javascript"> 
    	// Google Tag Manager 
    	(function(w, d, s, l, i) {
    		w[l] = w[l] || []; w[l].push({
    			'gtm.start': new Date().getTime(), event: 'gtm.js'
    		});
    	var f = d.getElementsByTagName(s)[0], j = d.createElement(s),
    	dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true;
    	j.src = '<https://www.googletagmanager.com/gtm.js?id=>' + i + dl;
    	f.parentNode.insertBefore(j, f);
    	})(window, document, 'script', 'dataLayer', 'GTM-XXXXXXX'); //replace GTM-XXXX with Google Tag Manager ID
    </script>
    
  6. Then add any other scripts that you’d like to add.

  7. Remember that if you are implementing other scripts that aren’t covered by the Smart Cookie Blocker (or if Smart Cookie Blocker is disabled), you will need to manually configure other scripts and tags to ensure they are blocked before the user gives consent.

Full code example

The full code should look like the full example below. The order of the scripts is important and these snippets should be added to the <head> of your HTML. The CMP Banner script should always be the first script.

<aside> ⚠️ Make sure to replace the XXXXXXXXX with your company ID below. You can find this when you go to Cookie Banner > Add to website.

Make sure to replace your Google Tag Manager id below as well.

</aside>