fix explicit manager bug

bug would adjust the script even if the check for an own cookieManager is not set
This commit is contained in:
MaxBUhe 2023-05-31 14:11:50 +02:00
parent 32e08a88ca
commit c17ae1cef5
2 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
[{if $oViewConf->D3blShowGtmScript() && !$oViewConf->getCookieManagerType()}]
[{if $oViewConf->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager (noscript) -->
<noscript>

View File

@ -27,7 +27,6 @@ class ViewConfig extends ViewConfig_parent
{
if ($this->sContainerId === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
}
return $this->sContainerId;
@ -77,6 +76,14 @@ class ViewConfig extends ViewConfig_parent
return $this->sCookieManagerType;
}
/**
* @return bool
*/
public function shallUseOwnCookieManager()
{
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
}
/**
* @return bool
*/
@ -86,7 +93,7 @@ class ViewConfig extends ViewConfig_parent
$oConfig = Registry::getConfig();
// No Cookie Manager in use
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
if (false === $this->shallUseOwnCookieManager()) {
return true;
}
@ -113,7 +120,6 @@ class ViewConfig extends ViewConfig_parent
return true;
}
// Cookie Manager not (yet) supported
return false;
}
@ -126,6 +132,10 @@ class ViewConfig extends ViewConfig_parent
{
$oConfig = Registry::getConfig();
if (false === $this->shallUseOwnCookieManager()){
return "";
}
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'USERCENTRICS') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');