Usercentrics (optional)
This module integrates Usercentrics Consent Management into Magento.
It covers both Usercentrics solutions, namely Usercentrics CMP as well as Cookiebot by Usercentrics.
Regardless the module allows enabling Google Consent Mode v2, so adding a JavaScript snippet to the page, that defines default consent settings, which are being read by Google Tag Manager.
Installation
composer require "creativestyle/magesuite-usercentrics"
Integration Configuration
Configuration depends on which integration is chosen.
Cookiebot by Usercentrics
If you use Cookiebot, enable the integration, choose appropriate integration type and configure domain group id.
Usercentrics CMP
If you use Usercentrics CMP, choose appropriate integration type and configure settings ID.
Preview mode
Usercentrics CMP supports the preview mode, to test settings before deploying changes, in order to see the preview mode status, change the configuration in the Magento Admin Panel, enabling it.
Google Consent Mode
Both integrations of cookie management platform - Usercentrics CMP and Cookiebot, have a support for Google Consent Mode v2. To enable it, webpage needs to set default consent settings in prior, before loading Google Tag Manager. Our extension adds default consent configuration snippet to the right place in the codebase, and the default consent settings can be configured in the admin panel.
To enable Google Consent Mode support, enable it in the Magesuite->Usercentrics->Google Consent Mode and configure default consent settings
If enabled, the following script is being added to the top of the page:
<script data-defer-ignore="true" data-cookieconsent="ignore">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("consent", "default", {
ad_personalization: "denied",
ad_storage: "denied",
ad_user_data: "denied",
analytics_storage: "denied",
functionality_storage: "denied",
personalization_storage: "denied",
security_storage: "granted",
wait_for_update: 500,
});
gtag("set", "ads_data_redaction", true);
gtag("set", "url_passthrough", true);
</script>
Final note
This module only adds Usercentrics or Cookiebot integration to the page and default consent settings for Google Consent Mode v2. With these in place, one can start configuring Google Tag Manager, to apply proper consent settings.
Reference links:
https://support.cookiebot.com/hc/en-us/articles/360015039559-Magento-installation
https://support.cookiebot.com/hc/en-us/articles/360016047000-Cookiebot-and-Google-Consent-Mode