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
bovenliggende 32e08a88ca
commit c17ae1cef5
2 gewijzigde bestanden met toevoegingen van 14 en 4 verwijderingen

Bestand weergeven

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

Bestand weergeven

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