TYPO3 Logo
Coding Freaks Cookie Manager
Options
View source How to edit Full documentation (single file)

Coding Freaks Cookie Manager

  • Introduction
  • Installation
  • Configuration
    • Auto Configuration (Beta)
    • Cookie Categories
    • Cookie Services
      • Example Services
      • Google Consent Mode
    • Extension Settings
    • Cookie Frontend Settings
  • Developer Corner
    • Custom Service Configuration
    • JavaScript API
    • EventDispatcher (PSR-14 Events)
    • Themes and Styling
    • Environment Tools
  • Known Problems
  • Change log
  • Sitemap
  1. Coding Freaks Cookie Manager
  2. Configuration
  3. Cookie Services
  4. Google Consent Mode

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_in_code field.
    • 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)

Add the Consentmode JavaScript to the opt_in_code 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_out_code 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
    Cosnentmode Admin
    • Select the "Administration" Tab and open the "Consent Mode Configuration" section.
    Consentmode Admin - Administration
    • Press the "Test Consentmode (optional)" Button to check if the consent update is successful.
    Consentmode Admin - Debug
    • Opt In in the Cookiemanager in your Typo3 Frontend
    Consentmode Admin - Debug
    • Opt Out in the Cookiemanager in your Typo3 Frontend
    Consentmode Admin - Debug
    • Opt In (Again) in the Cookiemanager in your Typo3 Frontend
    Consentmode Admin - Debug
  • Previous
  • Next
Reference to the headline

Copy and freely share the link

This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.

Copy this link into your TYPO3 manual.

Last rendered: Jun 03, 2025 17:54

  • Legal Notice
  • Privacy Policy