[OST497528][Added] usercentrips step/ option 2

detailed information about the new addings check docs: https://docs.usercentrics.com/#/consent-mode
This commit is contained in:
MaxBUhe 2024-05-29 15:51:16 +02:00
parent 8e52b0541a
commit 049454a782
5 changed files with 85 additions and 1 deletions

View File

@ -18,6 +18,7 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
$return = parent::render();
$this->addTplParam('d3ViewObject', $this);
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
return $return;
@ -34,6 +35,8 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
'_blEnableDebug',
'_blEnableConsentMode',
'_blEnableOwnCookieManager',
'_blEnableMeasurementCapabilities',
'_blEnableUsercentricsConsentModeApi',
];
foreach ($aCheckBoxParams as $checkBoxName){

View File

@ -16,6 +16,9 @@ $aLang = array(
'D3CONTAINERID' => 'Container-ID',
'D3ACTIVATEMOD' => 'Modul aktivieren',
'D3CNTRLPARAM' => 'Steuerungsparameter',
'D3INACTIVATEMOD' => 'Modul ist nicht aktiv! Es werde keine Funktionen ausgespielt!',
// Usercentrics Dynamische Optionen
'D3USRCNTRCSDYNOPT' => 'Usercentrics Dynamische Optionen',
// Use debug mode?
'D3USEDEBUGMODE' => "Debug-Modus aktivieren",
@ -28,6 +31,20 @@ $aLang = array(
'D3CMPUSEQ' => 'Cookie Manager nutzen?',
'D3CMP' => 'Consent Management Platform ( CMP )',
// Usercentrics Config
// activate Individual Default Values
'D3USRCNTRCSCFG_ACT_INDIVDEFVAL' => "usercentrics individual 'Default Values' aktiveren",
// standard Consent
'D3USRCNTRCSCFG_STD_CNST' => "GTM Standard Consent",
// activate consent mode API
'D3USRCNTRCSCFG_ACT_CNSTMDE_API' => "Usercentrics Consent Mode API aktivieren",
// consent mode api
'D3USRCNTRCSCFG_CNSTMDE_API' => "Consent Mode API",
'D3USRCNTRCSCFG_DOCS' => 'Nähere Infos zu den hier konfigurierbaren Einstellungen entnehmen Sie bitte der offiziellen
Dokumentation von Usercentrics selbst: <a href="https://docs.usercentrics.com/#/consent-mode" class="text-primary"><i class="bi bi-book-half"></i> Dokumentation</a>',
'D3USRCNTRCSCFG_WARNING' => "Bevor Sie hier Anpassungen machen, konsultieren Sie bitte einen technischen Support!<br>
Anpassungen können zu Beeinträchtigungen und Ausfall von Funktionen im Frontend führen!",
// Additional Config
// Server-Side tagging
'D3SERVERSIDETAGGING' => 'Server-Side tagging',

View File

@ -7,6 +7,7 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
@ -135,6 +136,49 @@
</div>
</div>
</div>
[{if $d3ViewConfObject->d3IsUsercentricsCMPChosen()}]
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-usercentricsdynamicoptions" aria-expanded="false" aria-controls="panelsStayOpen-usercentricsdynamicoptions">
[{oxmultilang ident="D3USRCNTRCSDYNOPT"}]
</button>
</h2>
<div id="panelsStayOpen-usercentricsdynamicoptions" class="accordion-collapse collapse">
<div class="accordion-body">
<div class="card bg-light rounded mb-3">
<div class="card-body">
<div class="text-danger mb-3">
[{oxmultilang ident="D3USRCNTRCSCFG_WARNING"}]
</div>
[{oxmultilang ident="D3USRCNTRCSCFG_DOCS"}]
</div>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="enabledefaultmeasurementvalues" name="editval[bool][_blEnableMeasurementCapabilities]" [{if $d3ViewObject->d3GetModuleConfigParam('_blEnableMeasurementCapabilities')}]checked[{/if}]>
<label class="form-check-label" for="flexCheckDefault">
[{oxmultilang ident="D3USRCNTRCSCFG_ACT_INDIVDEFVAL"}]
</label>
</div>
<div class="input-group mb-3">
<span class="input-group-text w-25" id="basic-addon3">[{oxmultilang ident="D3USRCNTRCSCFG_STD_CNST"}]</span>
<textarea name="editval[str][_sMeasurementCapabilities]" class="form-control" rows="15">[{$d3ViewObject->d3GetModuleConfigParam('_sDefaultMeasurementCapabilities')}]</textarea>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="enableUsercentricsConsentModeApi" name="editval[bool][_blEnableUsercentricsConsentModeApi]" [{if $d3ViewObject->d3GetModuleConfigParam('_blEnableUsercentricsConsentModeApi')}]checked[{/if}]>
<label class="form-check-label" for="flexCheckDefault">
[{oxmultilang ident="D3USRCNTRCSCFG_ACT_CNSTMDE_API"}]
</label>
</div>
<div class="input-group mb-3">
<span class="input-group-text w-25" id="basic-addon3">[{oxmultilang ident="D3USRCNTRCSCFG_CNSTMDE_API"}]</span>
<textarea name="editval[str][_sUsercentricsConsentModeApi]" class="form-control" rows="40">[{$d3ViewObject->d3GetModuleConfigParam('_sDefaultUsercentricsConsentModeApi')}]</textarea>
</div>
</div>
</div>
</div>
[{/if}]
</div>
</div>
</div>

View File

@ -10,7 +10,10 @@
[{strip}]
[{if $oViewConf->isGtmConsentModeSetActivated()}]
<script>
<script type="text/javascript">
[{if $oViewConf->d3IsUsercentricsCMPChosen() and $oViewConf->d3GetModuleConfigParam('_blEnableMeasurementCapabilities')}]
[{$oViewConf->d3GetModuleConfigParam('_sMeasurementCapabilities')|strip}]
[{else}]
function gtag() {
dataLayer.push(arguments);
}
@ -22,6 +25,13 @@
analytics_storage: "denied",
wait_for_update: 2000
});
[{/if}]
</script>
[{/if}]
[{if $oViewConf->d3IsUsercentricsCMPChosen() and $oViewConf->d3GetModuleConfigParam('_blEnableUsercentricsConsentModeApi')}]
<script type="text/javascript">
[{$oViewConf->d3GetModuleConfigParam('_sUsercentricsConsentModeApi')|strip}]
</script>
[{/if}]

View File

@ -12,6 +12,7 @@
namespace D3\GoogleAnalytics4\Modules\Core;
use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics;
use D3\GoogleAnalytics4\Application\Model\Constants;
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
@ -245,4 +246,13 @@ class ViewConfig extends ViewConfig_parent
{
return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID);
}
/**
* @return bool
*/
public function d3IsUsercentricsCMPChosen() :bool
{
return (bool) ($this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sCMPName
or $this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sAlternatename);
}
}