How to install Google Consent Mode V2?
You need a Google Analytics code to activate Google Consent Mode on your website. To enable this feature, simply follow these steps;
- Login to your seers account and select cookie consent.
- Select the domain, go to “Preferences” tab and enable Google Consent Mode V2
- Remember to enable the toggle button to “OK” to activate Google Consent Mode V2 in the “Settings” panel of the Seers CMP.
- Also, you must update the Google Analytics code, as described in Step 2.
To read more about Google consent mode V2 click here.
Step 1
Find the Google Analytics code in the header on the website or get it from your Google Analytics account.
The Google Analytics code looks like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx-x></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>
Step 2
Insert Google Consent Mode code (below in bold) before your Google Analytics Code or script.
<!-- The initial config of Consent Mode -->
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
wait_for_update: 500, 11});
gtag('set', 'ads_data_redaction', true);
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>
Step 3
Now, insert the Seers' CMP code after the Google Consent Code and before the Google Analytics code.
<script data-key="$2y$10$qSt2jQmM7yWQiyt1flSQ4OtRNjY8hxkLUwtjtG6IKl9sDlWgjh8W." data-name="CookieXray" src="https://cdn.seersco.com/banners/XXXXX/XXXXX/cb.js" type="text/javascript"></script>
Step 4
After adding Seers' CMP code, your actual code should look like this.
<script type='text/javascript'>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);}
gtag('consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
wait_for_update: 500, 11});
gtag('set', 'ads_data_redaction' , true);
</script>
<script data-key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
data-name='CookieXray' src='https://seersco.com/script/cb.js' type='text/javascript'></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>