TYPO3 Logo
Coding Freaks Cookie Manager
Release: 1.7

Loading data.

  • 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

Contributors Corner

  • View source of current document
  • How to edit
  • Edit current document on GitHub
  1. Coding Freaks Cookie Manager
  2. Configuration
  3. Cookie Services
  4. Google Consent Mode
Report issue View source How to edit Edit on GitHub

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. You can make a pull request on GitHub to suggest an anchor. The link below can be used, but is prone to change if the page gets moved.

Copy this link into your TYPO3 manual.

  • Home
  • Issues
  • Repository

Last rendered: Jan 17, 2025 16:40

© by Florian Eibisberger
  • Legal Notice
  • Privacy Policy