Merge remote-tracking branch 'remotes/origin/rel_1.x'

# Conflicts:
#	Application/views/admin/de/module_options.php
#	Application/views/ga4/view_item_list.tpl
#	CHANGELOG.md
#	Modules/Core/ViewConfig.php
#	metadata.php
This commit is contained in:
MaxBUhe 2023-05-31 14:51:07 +02:00
commit b8e2aeaa58
8 changed files with 74 additions and 27 deletions

View File

@ -31,8 +31,10 @@ $aLang = [
// for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER' => 'Nutzen Sie die Consentmanager-Einbindung?',
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_NO' => 'Nein',
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_YES' => 'Ja',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
Dann wählen Sie bitte die zutreffende aus.',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
];

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

@ -1,5 +1,5 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$products}]
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{assign var="breadCrumb" value=''}]

View File

@ -53,6 +53,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
### Added
- using of ContainerFactory in ViewConfig
## [1.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.7.0...1.8.0) - 2023-05-31
### Fixed
- bug in explicit manager selection
## [1.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.6.0...1.7.0) - 2023-05-31
### Added
- extended call to read the technical documentation
### Changed
- block-extension for view_item_list
- way of getting list-articles in view_item_list
## [1.6.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.5.0...1.6.0) - 2023-05-30
### Added
- possibility to choose between consentmanager && usercentrics
- position to block extension
### Changed
- genuine code cleanup
- usercentrics includation script
## [1.5.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.4.0...1.5.0) - 2023-05-23
### Added

View File

@ -12,8 +12,8 @@ Für den geregelten Ablauf sind folgende Blöcke nötig:
- Datei: page/search/search.tpl
- GA4 Event: view_search_results
- Artikelliste
- Blockname: d3Ga4_view_item_list (muss hinzugefügt werden)
- Datei: widget/product/list.tpl
- Blockname: page_list_productlist
- Datei: page/list/list.tpl
- GA4 Event: view_item_list
- Detailseite
- Blockname: details_productmain_title
@ -63,6 +63,6 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
- In der Usercentrics-Verwaltung einen Service für Google Analytics anlegen
- Den Service-Namen in den Moduleinstellungen des 'Google Analytics 4' unter
- In der Usercentrics-Verwaltung die Services "Google Analytics" und "Google Tag Manager" anlegen
- Den Service ```Google Tag Manager``` in den Moduleinstellungen des 'Google Analytics 4' unter
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen

View File

@ -37,9 +37,21 @@ class ViewConfig extends ViewConfig_parent
return $this->sContainerId;
}
public function getModuleConsentmanagerSettingSelectValue() :bool
/**
* @return mixed
*/
public function getModuleSettingExplicitManagerSelectValue()
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_CONSENTMANAGER') === 'YES';
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
}
/**
* @return false|mixed
*/
public function getExplicitManager()
{
$sManagerName = $this->getModuleSettingExplicitManagerSelectValue();
return $sManagerName === "NONE" ? false : $sManagerName;
}
public function getCookieManagerType()
@ -62,13 +74,21 @@ class ViewConfig extends ViewConfig_parent
}
}
if ($this->sCookieManagerType === false and $this->getModuleConsentmanagerSettingSelectValue()){
return "consentmanager";
if ($this->sCookieManagerType === false and $this->getExplicitManager()){
return "externalService";
}
return $this->sCookieManagerType;
}
/**
* @return bool
*/
public function shallUseOwnCookieManager()
{
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
}
/**
* @return bool
*/
@ -78,7 +98,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;
}
@ -99,13 +119,12 @@ class ViewConfig extends ViewConfig_parent
}
}
// UserCentrics
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'consentmanager') {
// UserCentrics or consentmanager
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'externalService') {
// Always needs the script-tags delivered to the DOM.
return true;
}
// Cookie Manager not (yet) supported
return false;
}
@ -118,15 +137,18 @@ class ViewConfig extends ViewConfig_parent
{
$oConfig = Registry::getConfig();
if ($this->getCookieManagerType() == "oxps_usercentrics") {
if (false === $this->shallUseOwnCookieManager()){
return "";
}
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'USERCENTRICS') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) {
return 'type="text/plain" data-usercentrics="' . $sCookieId . '"';
return 'data-usercentrics="' . $sCookieId . '" type="text/plain" async=""';
}
}
if ($this->getCookieManagerType() == "consentmanager") {
if ($this->getCookieManagerType() === "externalService" and $this->getExplicitManager() === 'CONSENTMANAGER') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) {

View File

@ -30,6 +30,10 @@ Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code aus
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
> ### Wichtig!
> Bitte stellen Sie sicher, dass die nötigen Blöcke im OXID-Shop zur Verfügung stehen.
> Lesen Sie mehr in der [technischen Doku](./Docs/README.md) unter "Blöcke"!
## Verwendung
### Grundfunktionalität
Nach erfolgreicher Installation finden Sie in Ihrem Shop-Admin unter "Erweiterungen > Module"

View File

@ -17,7 +17,7 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
",
'thumbnail' => 'thumbnail.png',
'version' => '2.5.0',
'version' => '1.8.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
@ -35,7 +35,8 @@ $aModule = [
[
'template' => 'layout/base.tpl',
'block' => 'head_meta_robots',
'file' => '/Application/views/blocks/_gtm_js.tpl'
'file' => '/Application/views/blocks/_gtm_js.tpl',
'position' => 150
],
// tag manager nojs
[
@ -64,8 +65,8 @@ $aModule = [
// Lists
// view_item_list
[
'template' => 'widget/product/list.tpl',
'block' => 'widget_product_list',
'template' => 'page/list/list.tpl',
'block' => 'page_list_productlist',
'file' => '/Application/views/ga4/view_item_list.tpl',
'position' => 150
],
@ -122,10 +123,10 @@ $aModule = [
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_HAS_CONSENTMANAGER',
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
'type' => 'select',
'value' => 'none',
'constraints' => 'NO|YES',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS',
],
]
];