Integration of usercentrics.com for Symfony

1.0.0 2019-12-16 15:24 UTC

This package is auto-updated.

Last update: 2022-01-20 17:31:44 UTC


This bundle provides a usercentrics.com implementation into Symfony.


Install this bundle via composer: composer req t3g/symfony-usercentrics-bundle


Create a file config/packages/usercentrics.yaml that contains the following configuration:

  id: xxxxxxxxx

Usage in Templates

At first, the usercentrics main library must be included. For this, the Twig function usercentrics() may be invoked without any additional arguments:

{{ usercentrics() }}

After that, additional Data Service Providers (DSP) may be included as well. See the following example for Google Analytics:

{{ usercentrics('Google Analytics', {async: true, src: 'https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X'}) }}
{{ usercentrics(
    'Google Analytics',
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag(\'js\', new Date());

        gtag(\'config\', \'UA-XXXXXXXX-X\');
) }}