8
0

[OST830498][Added] consent-mode standard values

Dieser Commit ist enthalten in:
MaxBUhe 2024-04-02 08:59:17 +02:00
Ursprung 1ae5a9d926
Commit a38dcb8e45
3 geänderte Dateien mit 38 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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) {

Datei anzeigen

@ -169,6 +169,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 "[]";

Datei anzeigen

@ -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',