[OST830498][Added] consent-mode standard values

This commit is contained in:
MaxBUhe 2024-04-02 08:59:17 +02:00
parent d856a994ab
commit 55306e0495
3 changed files with 38 additions and 0 deletions

View File

@ -6,6 +6,29 @@
[{if $oViewConf->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}]
[{strip}]
[{if $oViewConf->isGtmConsentModeSetActivated()}]
<script type="text/javascript">
// 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);
</script>
[{/if}]
<!-- Google Tag Manager -->
<script [{$oViewConf->getGtmScriptAttributes()}]>
(function (w, d, s, l, i) {

View File

@ -156,6 +156,14 @@ class ViewConfig extends ViewConfig_parent
return $this->blGA4enabled;
}
public function isGtmConsentModeSetActivated() :bool
{
return $this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_blActivateConsentMode', Constants::OXID_MODULE_ID);
}
public function getGtmDataLayer()
{
if (!$this->getGtmContainerId()) return "[]";

View File

@ -190,6 +190,13 @@ $aModule = [
'value' => false,
'position' => 999
],
[
'group' => 'd3_gtm_settings',
'name' => 'd3_gtm_blActivateConsentMode',
'type' => 'bool',
'value' => false,
'position' => 999
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_hasOwnCookieManager',