LIA Usercentrics 

This TYPO3 extension integrates a cookie banner for managing consent for external services such as analytics, social media, etc. It ensures that external sources (like YouTube videos, Vimeo, or other integrated services) are blocked by default until the user grants consent for their use.

Installation 

Explains how to install this extension in Composer-based and Classic TYPO3 installations.

Configuration 

Learn how to setup up and configure this extension.

Frequently Asked Questions (FAQ) 

These questions have been frequently asked.

How to get help 

Learn where to get help and how to report issues you found.

Basic configuration 

After the extension is installed first you have to load the typoscript into your static template.

Basic configuration 

After the typoscript is loaded you have to override the constants of this extension and set them to load the usercentrics Library on you page.

Best Practice 

Create a Constants.typoscript file in your provider extension to override the default constants. You can create it in subfolder like this: my_extension/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript. Make sure that this file is also loaded in your constants.typoscript file. To load this file add an import in it. @import 'EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript'

Now place this code in it and set the constants to your need.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript
plugin.tx_liausercentrics {
  srcUrl = https://web.cmp.usercentrics.eu/ui/loader.js
  settingsId =
  ucQueryParameter =
  settings {
    activate = 0
    tcfEnabled = 0
    useSmartDataProtector = 0
    footerLink = 0
    excludedPages =
    whitelistedSDPServices =
    customOverlayIntegration =
  }
}
Copied!

To load Usercentrics, enter your Usercentrics ID in settingsId and set the constant activate to 1. If you want to use the Smart Data Protector, set the constant the constant useSmartDataProtector to 1.

Language 

The current language is passed to Usercentrics automatically by getting the language code from the current locale:

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript
plugin.tx_liausercentrics {
  ...
  language = TEXT
  language.data = siteLanguage:locale:languageCode
  ...
}
Copied!

The language variable accepts plain strings and content objects like TEXT.

TCF enabled 

Set the constant tcfEnabled to 1 to add the data-tcf-enabled attribute to the Usercentrics script tag. This activates the IAB Transparency & Consent Framework (TCF) mode in Usercentrics.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript
plugin.tx_liausercentrics {
  settings {
    tcfEnabled = 1
  }
}
Copied!

This renders the following script tag in the page header:

<script id="usercentrics-cmp" src="..." data-settings-id="..." data-language="..." data-tcf-enabled></script>
Copied!

Smart Data Protector configuration 

You can also configure and restrict the Smart Data Protector.

Restrict the Smart Data Protector 

The Smart Data Protector scans for integrated services each time a page is called up and blocks them if it recognizes and the cookie for this service is not set. To limit the list of services, you can enter the Template IDs in the constant whitelistedSDPServices separated by a comma.

You can find the template IDs when configuring the services in Usercentrics.

Here you will also find all the services known to the Smart Data Protector.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript
plugin.tx_liausercentrics {
  srcUrl = https://web.cmp.usercentrics.eu/ui/loader.js
  settingsId =
  ucQueryParameter =
  settings {
    activate = 0
    useSmartDataProtector = 0
    footerLink = 0
    excludedPages =
    whitelistedSDPServices = S1pcEj_jZX, BJ59EidsWQ, Hko_qNsui-Q, BJz7qNsdj-7, HyEX5Nidi-m
    customOverlayIntegration =
  }
}
Copied!

Overlay for Custom service integration 

If you integrate a service using your own logic, e.g. your own JavaScript, you can add a data attribute to the container where the content of the service is displayed and configure this in the TypoScript. The overlay is then inserted by the Smart Data Protector.

Add this attribute data-uc=“gMaps” to the container and enter the Template Id of the service followed by a colon and the value of the data attribute. S1pcEj_jZX:gMaps. You can add several configurations here. These only need to be separated by a comma.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Constants.typoscript
plugin.tx_liausercentrics {
  srcUrl = https://web.cmp.usercentrics.eu/ui/loader.js
  settingsId =
  ucQueryParameter =
  settings {
    activate = 0
    useSmartDataProtector = 0
    footerLink = 0
    excludedPages =
    whitelistedSDPServices = S1pcEj_jZX, BJ59EidsWQ, Hko_qNsui-Q, BJz7qNsdj-7, HyEX5Nidi-m
    customOverlayIntegration = S1pcEj_jZX:gMaps
  }
}
Copied!

The container would then look like this.

<div data-uc="gMaps"></div>
Copied!

Block JavaScript 

If you have JavaScript integrations that you need to block, then create a Setup.typoscript in the same folder in which you created the Constants.typoscript. This file is used to configure the various JavaScript, both inline and as a file. This file must also be loaded in the setup.typoscript of your provider extension. To load this file add an import in it. @import 'EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript'

Blocking of files 

In this example you can see a configuration of an inline JavaScript for the integration of the Google tag manager.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript
plugin.tx_liausercentrics.jsFile {
    10 {
        file = EXT:yourext/Resources/Public/JavaScript/GoogleTagManagerIntegration.js
        dataProcessingService = Google Tag Manager
    }
}
Copied!

If you already have an inline integration of the GTM at another location, you can also assign this to the value. However, this should also be emptied afterwards so that you do not have a duplicate integration.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript
plugin.tx_liausercentrics.jsFile {
    10 {
        fiel < page.includeJS.googleTagManager
        dataProcessingService = Google Tag Manager
    }
}

[usercentricsIsActive('{$plugin.tx_liausercentrics.settings.activate}', '{$plugin.tx_liausercentrics.settingsId}')]
    page.includeJS.googleTagManager >
[global]
Copied!

Blocking of inline JavaScript 

In this example you can see a configuration of an inline JavaScript for the integration of the Google tag manager.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript
plugin.tx_liausercentrics.jsInline {
    10 {
        value (
            // create dataLayer
            window.dataLayer = window.dataLayer || [];
            function gtag() {
                dataLayer.push(arguments);
            }

            // set „denied" as default for both ad and analytics storage, as well as ad_user_data and ad_personalization,
            gtag("consent", "default", {
                ad_user_data: "denied",
                ad_personalization: "denied",
                ad_storage: "denied",
                analytics_storage: "denied",
                wait_for_update: 2000 // milliseconds to wait for update
            });

            // Enable ads data redaction by default [optional]
            gtag("set", "ads_data_redaction", true);

            // 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');
        )
        dataProcessingService = Google Tag Manager
    }
}
Copied!

If you already have an inline integration of the GTM at another location, you can also assign this to the value. However, this should also be emptied afterwards so that you do not have a duplicate integration.

EXT:site_package/Configuration/TypoScript/Extensions/LiaUsercentrics/Setup.typoscript
plugin.tx_liausercentrics.jsInline {
    10 {
        value < page.FooterData.googleTagManager.value
        dataProcessingService = Google Tag Manager
    }
}

[usercentricsIsActive('{$plugin.tx_liausercentrics.settings.activate}', '{$plugin.tx_liausercentrics.settingsId}')]
    page.FooterData.googleTagManager >
[global]
Copied!

Frequently Asked Questions (FAQ) 

See chapter Installation.

(1/1) #1741944668 LIA\LiaUsercentrics\Exceptions\LiaUsercentricsException
The Usercentrics settings are not set.
Copied!

This error occurs when the necessary Usercentrics settings have not been properly configured in your TYPO3 installation. The extension is unable to find the required TypoScript configuration for Usercentrics, which is essential for managing cookie consent and other privacy settings.

  1. Go to the TYPO3 backend.
  2. Navigate to the Site Management > TypoScript module.
  3. Select the page where you want the Usercentrics settings to be applied (typically the root page of your site).
  4. Select Edit TypoScript Record and klick on Edit the whole TypoScript record
  5. In the "Advanced Options" tab, scroll down to find the list of static templates.
  6. Add the necessary static template for Usercentrics, "LIA Usercentrics (lia_usercentrics)".
  7. Save the changes.

This will ensure that the required TypoScript settings are loaded and the extension can properly access the Usercentrics configuration.

See also chapter Configuration.

See chapter Where to get help.