[OST#929760][Added] serverside tagging usability

*missing any test, yet!
This commit is contained in:
MaxBUhe 2024-03-19 09:22:07 +01:00
parent 97c3927998
commit 201bcb6e37
4 changed files with 41 additions and 2 deletions

View File

@ -13,7 +13,7 @@
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;
j.src = '[{$oViewConf->getServerSidetaggingJsDomain()}]?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
</script>

View File

@ -2,7 +2,7 @@
[{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=[{$oViewConf->getGtmContainerId()}]"
<iframe src="[{$oViewConf->getServerSidetaggingNoJsDomain()}]?id=[{$oViewConf->getGtmContainerId()}]"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

View File

@ -203,4 +203,30 @@ class ViewConfig extends ViewConfig_parent
$oConfig = Registry::getConfig();
$aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross'];
}
/**
* @return string
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getServerSidetaggingJsDomain() :string
{
return ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_settings_serversidetagging_js', 'd3googleanalytics4');
}
/**
* @return string
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getServerSidetaggingNoJsDomain() :string
{
return ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_settings_serversidetagging_nojs', 'd3googleanalytics4');
}
}

View File

@ -210,5 +210,18 @@ $aModule = [
'value' => 'none',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT',
],
// OST929760 - Erweiterung für Serverside Tagging
[
'group' => 'd3_gtm_settings_serversidetagging',
'name' => 'd3_gtm_settings_serversidetagging_js',
'type' => 'str',
'value' => 'https://www.googletagmanager.com/gtm.js',
],
[
'group' => 'd3_gtm_settings_serversidetagging',
'name' => 'd3_gtm_settings_serversidetagging_nojs',
'type' => 'str',
'value' => 'https://www.googletagmanager.com/ns.html',
],
]
];