Google Consent Mode
- Add Tag Manager to your Website with Coding-Freaks cookie manager Backend module.
-
- Open the Backend Module and open the "Analytics" Category.
- Serach for "Google Tag Manager" in services and add it to the Analytics Category.
- Save the Category
- Fill in your Variable Provider for your Google TAG ID - or replace it in the
opt_
field.in_ code -
- open the "Google Tag Manager" Service (detail-view).
- Switch to Script Tab.
- Scroll down to the Variable Provider Section and create a Assignement for your Google Tag Manager ID. (GT_TRACKING_ID)
- Fill in your Variable Provider for your Google TAG ID - or replace it in the
Add the Consentmode JavaScript to the opt_
field.
var script1 = document.createElement('script');
script1.type = 'text/javascript';
script1.async = true;
script1.src = 'https://www.googletagmanager.com/gtag/js?id=[##GT_TRACKING_ID##]';
script1.setAttribute('data-cookiecategory', 'analytics');
var script2 = document.createElement('script');
script2.type = 'text/javascript';
script2.setAttribute('data-cookiecategory', 'analytics');
script2.innerHTML = `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
console.log("Header");
gtag('config', '[##GT_TRACKING_ID##]');
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});
gtag('consent', 'update', {
'ad_storage': 'granted',
'ad_user_data': 'granted',
'ad_personalization': 'granted',
'analytics_storage': 'granted'
});
`;
script1.onload = function() {
document.head.appendChild(script2);
};
document.head.appendChild(script1);
Copied!
Add Consentmode Update to the opt_
field.
gtag('consent', 'update', {
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'ad_storage': 'denied',
'analytics_storage': 'denied'
});
Copied!
- Go to your Tag Manager Admin page, to consentmode configuration and press "Test Consentmode (optional)" to check if the Consent update is successful.
-
- Open https://tagmanager.google.com/# and select your account or tag to open the admin page.
- Open the Tag Manager Configuration Page
- Select the "Administration" Tab and open the "Consent Mode Configuration" section.
- Press the "Test Consentmode (optional)" Button to check if the consent update is successful.
- Opt In in the Cookiemanager in your Typo3 Frontend
- Opt Out in the Cookiemanager in your Typo3 Frontend
- Opt In (Again) in the Cookiemanager in your Typo3 Frontend