[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 9410495a58
commit bc8876367c
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'}); 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 : ''; var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true; 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); f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]'); })(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
</script> </script>

View File

@ -2,7 +2,7 @@
[{if $oViewConf->getGtmContainerId()}][{strip}] [{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager (noscript) --> <!-- Google Tag Manager (noscript) -->
<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> height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript> </noscript>
<!-- End Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) -->

View File

@ -215,4 +215,30 @@ class ViewConfig extends ViewConfig_parent
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
$aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross']; $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', 'value' => 'none',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT', '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',
],
] ]
]; ];