From bc8876367cdb92ecd01404d9f7dc5db753712d7b Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 19 Mar 2024 09:22:07 +0100 Subject: [PATCH 01/58] [OST#929760][Added] serverside tagging usability *missing any test, yet! --- Application/views/blocks/_gtm_js.tpl | 2 +- Application/views/blocks/_gtm_nojs.tpl | 2 +- Modules/Core/ViewConfig.php | 26 ++++++++++++++++++++++++++ metadata.php | 13 +++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index de0cb3e..8f8856f 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -13,7 +13,7 @@ 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 : ''; 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); })(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]'); diff --git a/Application/views/blocks/_gtm_nojs.tpl b/Application/views/blocks/_gtm_nojs.tpl index 98a47ad..e15907e 100644 --- a/Application/views/blocks/_gtm_nojs.tpl +++ b/Application/views/blocks/_gtm_nojs.tpl @@ -2,7 +2,7 @@ [{if $oViewConf->getGtmContainerId()}][{strip}] diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index fd3468d..0d65126 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -215,4 +215,30 @@ class ViewConfig extends ViewConfig_parent $oConfig = Registry::getConfig(); $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'); + } } \ No newline at end of file diff --git a/metadata.php b/metadata.php index fb8c1c7..a56cb60 100755 --- a/metadata.php +++ b/metadata.php @@ -210,5 +210,18 @@ $aModule = [ 'value' => 'none', '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', + ], ] ]; \ No newline at end of file From 9a48d32c3b3084782f5be920249670e77d69f19c Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 20 Mar 2024 10:11:42 +0100 Subject: [PATCH 02/58] [OST#929760][Added] multilang texts for desc Test: OK --- Application/views/admin/de/module_options.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Application/views/admin/de/module_options.php b/Application/views/admin/de/module_options.php index 555ae53..8934da9 100755 --- a/Application/views/admin/de/module_options.php +++ b/Application/views/admin/de/module_options.php @@ -27,6 +27,52 @@ $aLang = [ 'SHOP_MODULE_d3_gtm_blGA4enab' => 'GA4 Aktivieren', 'SHOP_MODULE_d3_gtm_blUAenabled' => 'UA Aktivieren', 'SHOP_MODULE_d3_gtm_blEnableDebug' => 'Debug-Modus aktivieren', + 'SHOP_MODULE_GROUP_d3_gtm_settings_serversidetagging' => 'Server-Side tagging', + 'SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Servercontainer Ausführender-Code', + 'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Diese Domain wird im aktiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag script handelt. + Dieses kümmert sich darum, dass die, im data_layer + zusammengefassten Daten an den GTM weitergeleitet werden.
+
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+https://www.googletagmanager.com/gtm.js?id=
+
+Nachher:
+{Domain}?id=
+
+                                                                        
+ Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen! + ', + 'SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Servercontainer NICHT Ausführender-Code

+ "Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.
+ Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.
+ Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können."
+
+ - Quelle Developers-Google Server-Side tagging
+
+ Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen! +', + 'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Diese Domain wird im passiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag noscript handelt. + Dieses wird ausgeführt, wenn aus einem bestimmten Grund + das Javascript nicht ausgeführt wird.
+ ( keine Cookies erlaubt, JavaScript-Unterbindung, ... ) +
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+src="https://www.googletagmanager.com/ns.html?id={Container-ID}"
+
+Nachher:
+src="{Domain}?id={Container-ID}"
+
+                                                                        
+ Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen! + ', // for cookie manager settings 'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen', From 938d1514a672ff57ccc4190c531b5f72ee0f749b Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 20 Mar 2024 10:14:06 +0100 Subject: [PATCH 03/58] [Bump] Changelog && Metadata --- CHANGELOG.md | 4 ++++ metadata.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed1ef38..202bdef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.15.0...2.16.0) - 2024-03-20 +### Added +- ( Google ) Server-Side tagging usability + ## [2.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.14.0...2.15.0) - 2024-02-05 ### Fixed - missing Component-ArticleDetails extension, missing ManufacturerListController extension diff --git a/metadata.php b/metadata.php index a56cb60..4965d3e 100755 --- a/metadata.php +++ b/metadata.php @@ -48,7 +48,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.15.0', + 'version' => '2.16.0', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', From 1ae5a9d92610d7f8fda52bab57d690cabd2cd71c Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Mon, 25 Mar 2024 09:06:22 +0100 Subject: [PATCH 04/58] [OST830498][Changed] metadataid centralized --- Application/Model/Constants.php | 11 +++++++++++ Modules/Core/ViewConfig.php | 9 +++++---- metadata.php | 3 ++- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Application/Model/Constants.php diff --git a/Application/Model/Constants.php b/Application/Model/Constants.php new file mode 100644 index 0000000..c8035e8 --- /dev/null +++ b/Application/Model/Constants.php @@ -0,0 +1,11 @@ +sContainerId = ContainerFactory::getInstance() ->getContainer() ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_sContainerID', 'd3googleanalytics4'); + ->get('d3_gtm_sContainerID', Constants::OXID_MODULE_ID); } return $this->sContainerId; } @@ -162,7 +163,7 @@ class ViewConfig extends ViewConfig_parent $this->sContainerId = ContainerFactory::getInstance() ->getContainer() ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_blEnableGA4', 'd3googleanalytics4'); + ->get('d3_gtm_blEnableGA4', Constants::OXID_MODULE_ID); } return $this->blGA4enabled; @@ -226,7 +227,7 @@ class ViewConfig extends ViewConfig_parent return ContainerFactory::getInstance() ->getContainer() ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_js', 'd3googleanalytics4'); + ->get('d3_gtm_settings_serversidetagging_js', Constants::OXID_MODULE_ID); } /** @@ -239,6 +240,6 @@ class ViewConfig extends ViewConfig_parent return ContainerFactory::getInstance() ->getContainer() ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_nojs', 'd3googleanalytics4'); + ->get('d3_gtm_settings_serversidetagging_nojs', Constants::OXID_MODULE_ID); } } \ No newline at end of file diff --git a/metadata.php b/metadata.php index 4965d3e..3545fba 100755 --- a/metadata.php +++ b/metadata.php @@ -1,5 +1,6 @@ 'd3googleanalytics4', + 'id' => Constants::OXID_MODULE_ID, 'title' => 'Google Analytics 4', 'description' => "Dieses Modul bietet die Möglichkeit in Ihrem OXID eShop (6.x) die neue 'Property' Google Analytics 4 (GA4) von Google zu integrieren.
From a38dcb8e45bb92e9e15818d8b66fe17a53dea51c Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 2 Apr 2024 08:59:17 +0200 Subject: [PATCH 05/58] [OST830498][Added] consent-mode standard values --- Application/views/blocks/_gtm_js.tpl | 23 +++++++++++++++++++++++ Modules/Core/ViewConfig.php | 8 ++++++++ metadata.php | 7 +++++++ 3 files changed, 38 insertions(+) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index 8f8856f..bc41995 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -6,6 +6,29 @@ [{if $oViewConf->D3blShowGtmScript()}] [{if $oViewConf->getGtmContainerId()}] [{strip}] + + [{if $oViewConf->isGtmConsentModeSetActivated()}] + + [{/if}] + [{/if}] From 8079eee236fdd01a41377403d64e40547dede619 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 10 Apr 2024 11:45:48 +0200 Subject: [PATCH 09/58] [OST830498][Removed] ( for now ) unnecessary set --- Application/views/blocks/_gtm_js.tpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index 28c17ca..c1ac162 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -20,8 +20,6 @@ analytics_storage: "denied", wait_for_update: 2000 }); - - gtag("set", "ads_data_redaction", true); [{/if}] From c32c66322f853ea821e29ba69ad5cf25ab481e0a Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 10 Apr 2024 11:58:14 +0200 Subject: [PATCH 10/58] [Changed] styling --- Application/views/blocks/_gtm_js.tpl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index c1ac162..35f1158 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -8,19 +8,19 @@ [{strip}] [{if $oViewConf->isGtmConsentModeSetActivated()}] - + gtag("consent", "default", { + ad_user_data: "denied", + ad_personalization: "denied", + ad_storage: "denied", + analytics_storage: "denied", + wait_for_update: 2000 + }); + [{/if}] From ec2d43ff3caa76fd5298b2ce885166e9c42c7844 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 10 Apr 2024 12:01:37 +0200 Subject: [PATCH 11/58] [Bump] Metadata && Changelog --- CHANGELOG.md | 9 +++++++++ metadata.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 202bdef..5e7b0d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.16.0...2.17.0) - 2024-04-10 +### Added +- Google-Analytics default values +- default values switch ( admin module settings ) +- translations + +## Changed +- centralized metadata-id + ## [2.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.15.0...2.16.0) - 2024-03-20 ### Added - ( Google ) Server-Side tagging usability diff --git a/metadata.php b/metadata.php index b26430c..4bd619c 100755 --- a/metadata.php +++ b/metadata.php @@ -49,7 +49,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.16.0', + 'version' => '2.17.0', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', From ce1614996af346ded395b9299d67de95d3399748 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 10 Apr 2024 12:21:21 +0200 Subject: [PATCH 12/58] [Fixed] getGtmContainerId gave false/ null on second call method gave false --- Application/views/blocks/_gtm_js.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index 35f1158..4ff4f37 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -3,12 +3,14 @@ var dataLayer = [{$oViewConf->getGtmDataLayer()}] || []; +[{assign var="d3GtmContainerIdString" value=$oViewConf->getGtmContainerId()}] + [{if $oViewConf->D3blShowGtmScript()}] - [{if $oViewConf->getGtmContainerId()}] + [{if $d3GtmContainerIdString}] [{strip}] [{if $oViewConf->isGtmConsentModeSetActivated()}] - [{/strip}] From b3f2446a7d44f7a80a06e900bf08187a9e879505 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 10 Apr 2024 12:23:04 +0200 Subject: [PATCH 13/58] [Bump] Metadata && Changelog --- CHANGELOG.md | 4 ++++ metadata.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e7b0d2..6941a71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10 +### Fixed +- second call of getGtmContainerId() ( returned false ) + ## [2.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.16.0...2.17.0) - 2024-04-10 ### Added - Google-Analytics default values diff --git a/metadata.php b/metadata.php index 4bd619c..2e2170d 100755 --- a/metadata.php +++ b/metadata.php @@ -49,7 +49,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.17.0', + 'version' => '2.17.1', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', From 7847ad9874aad47fbc6269d6c3ad386dc7dd7ef8 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 26 Mar 2024 11:31:15 +0100 Subject: [PATCH 14/58] [Fixed] potential error if no basket-component is given, error occurs --- Application/views/event/add_to_cart.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/views/event/add_to_cart.tpl b/Application/views/event/add_to_cart.tpl index 8d85631..ecb54f0 100644 --- a/Application/views/event/add_to_cart.tpl +++ b/Application/views/event/add_to_cart.tpl @@ -1,5 +1,5 @@ -[{if $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}] +[{if $d3CmpBasket && $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}] [{assign var="oGtmProduct" value=$d3CmpBasket->d3GtmRequestedArticleLoadedByAnid()}] [{assign var="oGtmAmountArticlesAdded" value=$d3CmpBasket->getD3GtmAddToCartAmountArticles()}] [{*$smarty.block.parent*}] From 17839b319e158dcc038f01bccb891da259e8d78a Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 11 Apr 2024 11:42:24 +0200 Subject: [PATCH 15/58] [Bump] metadata && changelog --- CHANGELOG.md | 4 ++++ metadata.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6941a71..7e35724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.17.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.1...2.17.2) - 2024-04-11 +### Fixed +- error on missing necessary-component + ## [2.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10 ### Fixed - second call of getGtmContainerId() ( returned false ) diff --git a/metadata.php b/metadata.php index 2e2170d..48daa2f 100755 --- a/metadata.php +++ b/metadata.php @@ -49,7 +49,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.17.1', + 'version' => '2.17.2', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', From db39d4155f355c31ea95f0f88c8bd73a80e0c96e Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 11 Apr 2024 11:34:36 +0200 Subject: [PATCH 16/58] [Bump] changelog --- CHANGELOG.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e35724..4fcd824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.17.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.1...2.17.2) - 2024-04-11 -### Fixed -- error on missing necessary-component - ## [2.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10 ### Fixed - second call of getGtmContainerId() ( returned false ) @@ -17,7 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Google-Analytics default values - default values switch ( admin module settings ) - translations - ## Changed - centralized metadata-id @@ -163,6 +158,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - using of ContainerFactory in ViewConfig +## [1.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.16.0...1.17.0) - 2024-04-11 +### Added +- multilang translations +- GA4 consent-mode default values +### Changed +- metadataID centralized + +## [1.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.15.1...1.16.0) - 2024-04-11 +### Added +- ( Google ) Server-Side tagging usability + ## [1.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.14.0...1.15.0) - 2024-01-25 ### Fixed - missing Component-ArticleDetails extension, missing ManufacturerListController extension From efc9aa08e03b9952b80cddfd8ce1461fa2de53d9 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 11 Apr 2024 12:01:12 +0200 Subject: [PATCH 17/58] [Bump] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fcd824..2d07434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.17.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.1...2.17.2) - 2024-04-11 +### Fixed +- error on missing necessary-component + ## [2.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10 ### Fixed - second call of getGtmContainerId() ( returned false ) From 681d0932e01bbf3bebd33974355042b7efbaf908 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Fri, 12 Apr 2024 10:04:04 +0200 Subject: [PATCH 18/58] [Added] trait for generalized method --- Modules/Application/Model/Category.php | 38 +--------------- Modules/Application/Model/Manufacturer.php | 38 +--------------- Modules/Application/Model/Vendor.php | 11 +++++ .../Model/articleTreeStructure.php | 44 +++++++++++++++++++ 4 files changed, 57 insertions(+), 74 deletions(-) create mode 100644 Modules/Application/Model/Vendor.php create mode 100644 Modules/Application/Model/articleTreeStructure.php diff --git a/Modules/Application/Model/Category.php b/Modules/Application/Model/Category.php index 713e4a5..42c3cb7 100644 --- a/Modules/Application/Model/Category.php +++ b/Modules/Application/Model/Category.php @@ -4,41 +4,5 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model; class Category extends Category_parent { - /** - * @param int $indexOfArray - * @return string - */ - public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string - { - if ($bShallTakeStd){ - $splitCatArray = - array_values( - array_filter( - explode( - '/', - trim( - parse_url( - $this->getLink(), - 5 - ) - ) - ) - ) - ); - - if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){ - return $splitCatArray[$indexOfArray]; - }else{ - return ""; - } - } - - return - trim( - parse_url( - $this->getLink(), - 5 - ) - ); - } + use articleTreeStructure; } \ No newline at end of file diff --git a/Modules/Application/Model/Manufacturer.php b/Modules/Application/Model/Manufacturer.php index 1d98dda..3bf2de6 100644 --- a/Modules/Application/Model/Manufacturer.php +++ b/Modules/Application/Model/Manufacturer.php @@ -4,41 +4,5 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model; class Manufacturer extends Manufacturer_parent { - /** - * @param int $indexOfArray - * @return string - */ - public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string - { - if ($bShallTakeStd){ - $splitCatArray = - array_values( - array_filter( - explode( - '/', - trim( - parse_url( - $this->getLink(), - 5 - ) - ) - ) - ) - ); - - if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){ - return $splitCatArray[$indexOfArray]; - }else{ - return ""; - } - } - - return - trim( - parse_url( - $this->getLink(), - 5 - ) - ); - } + use articleTreeStructure; } \ No newline at end of file diff --git a/Modules/Application/Model/Vendor.php b/Modules/Application/Model/Vendor.php new file mode 100644 index 0000000..87caded --- /dev/null +++ b/Modules/Application/Model/Vendor.php @@ -0,0 +1,11 @@ +getLink(), + 5 + ) + ) + ) + ) + ); + + if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){ + return $splitCatArray[$indexOfArray]; + }else{ + return ""; + } + } + + return + trim( + parse_url( + $this->getLink(), + 5 + ) + ); + } +} \ No newline at end of file From a1846274432e51b10beaeca159961057b3344821 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Fri, 12 Apr 2024 10:07:38 +0200 Subject: [PATCH 19/58] [Added] unreleased branch comparison to chnagelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d07434..7c03a3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.2...rel_2.x) - 2024-x +### Added +- trait for generalized method + ## [2.17.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.1...2.17.2) - 2024-04-11 ### Fixed - error on missing necessary-component From 96f6321b14b88b25d4912b9b3d1a992eed6a7f78 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 23 May 2024 10:30:11 +0200 Subject: [PATCH 20/58] [Changed] declare module settings consistency --- Application/views/admin/de/module_options.php | 52 +++++++----- metadata.php | 84 +++++++++---------- 2 files changed, 71 insertions(+), 65 deletions(-) diff --git a/Application/views/admin/de/module_options.php b/Application/views/admin/de/module_options.php index 195eccf..fed5414 100755 --- a/Application/views/admin/de/module_options.php +++ b/Application/views/admin/de/module_options.php @@ -10,6 +10,8 @@ * @link https://www.oxidmodule.com */ +use D3\GoogleAnalytics4\Application\Model\Constants as Constants; + $style = ''; $aLang = [ 'charset' => 'UTF-8', - 'SHOP_MODULE_d3_gtm_sContainerID' => 'Container ID', - 'SHOP_MODULE_GROUP_d3_gtm_settings' => 'Einstellungen', - 'SHOP_MODULE_d3_gtm_blGA4enab' => 'GA4 Aktivieren', - 'SHOP_MODULE_d3_gtm_blUAenabled' => 'UA Aktivieren', - 'SHOP_MODULE_d3_gtm_blEnableDebug' => 'Debug-Modus aktivieren', - 'SHOP_MODULE_GROUP_d3_gtm_settings_serversidetagging' => 'Server-Side tagging', - 'SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Servercontainer Ausführender-Code', - 'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Diese Domain wird im aktiven-code ausgefüht. Das heißt, + + // STD-Einstellungen + 'SHOP_MODULE_GROUP_'.Constants::OXID_MODULE_ID.'_settings' => 'Einstellungen', + 'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'_sContainerID' => 'Container ID', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_blGA4enab' => 'GA4 Aktivieren', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_blUAenabled' => 'UA Aktivieren', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_blEnableDebug' => 'Debug-Modus aktivieren', + + // Serverside - tagging + 'SHOP_MODULE_GROUP_'.Constants::OXID_MODULE_ID.'_serversidetagging' => 'Server-Side tagging', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_serversidetagging_js' => 'Servercontainer Ausführender-Code', + 'HELP_SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_serversidetagging_js' => 'Diese Domain wird im aktiven-code ausgefüht. Das heißt, dass es sich hierbei um das HTML-Tag script handelt. Dieses kümmert sich darum, dass die, im data_layer zusammengefassten Daten an den GTM weitergeleitet werden.
@@ -46,7 +52,7 @@ Nachher: Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen! ', - 'SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Servercontainer NICHT Ausführender-Code

+ 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_serversidetagging_nojs' => 'Servercontainer NICHT Ausführender-Code

"Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.
Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.
Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können."
@@ -55,7 +61,7 @@ Nachher:
Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen! ', - 'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Diese Domain wird im passiven-code ausgefüht. Das heißt, + 'HELP_SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_serversidetagging_nojs' => 'Diese Domain wird im passiven-code ausgefüht. Das heißt, dass es sich hierbei um das HTML-Tag noscript handelt. Dieses wird ausgeführt, wenn aus einem bestimmten Grund das Javascript nicht ausgeführt wird.
@@ -75,29 +81,29 @@ src="{Domain}?id={Container-ID}" ', // for cookie manager settings - 'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen', - 'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?', - 'HELP_SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages

+ 'SHOP_MODULE_GROUP_'.Constants::OXID_MODULE_ID.'_cookiemanager' => 'Cookie Manager Einstellungen', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_hasOwnCookieManager' => 'Cookie Manager nutzen?', + 'HELP_SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages

Consentmanager
Usercentrics
Cookiefirst

Bei weiteren Fragen stehen wir gern zur Verfügung! Kontaktieren Sie uns einfach unter https://www.d3data.de/', - 'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?
+ 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?
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_HAS_STD_MANAGER_COOKIEFIRST' => 'cookiefirst', - 'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_COOKIEBOT' => 'Cookiebot', - 'SHOP_MODULE_d3_gtm_settings_controlParameter' => 'Steuerungsparameter', - 'HELP_SHOP_MODULE_d3_gtm_settings_controlParameter' => 'Nähere infos zum "Steuerungsparameter"
+ 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER_NONE' => '---', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER_COOKIEFIRST' => 'cookiefirst', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER_COOKIEBOT' => 'Cookiebot', + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_controlParameter' => 'Steuerungsparameter', + 'HELP_SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_controlParameter' => 'Nähere infos zum "Steuerungsparameter"
Beachte:
Sofern Sie die consentmanager CMP verwenden, bitte ich Sie, gründlichst, die Hinweise der Moduldokumentation/Consentmanager zu lesen. ', - 'SHOP_MODULE_d3_gtm_blActivateConsentMode' => "Google Consent Mode 'Default Values' aktivieren", - 'HELP_SHOP_MODULE_d3_gtm_blActivateConsentMode' => 'Diese Einstellung ist zu aktivieren, wenn Sie den Google-Consent-Mode ( Einwilligungsmodus ) verwenden wollen. + 'SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_blActivateConsentMode' => "Google Consent Mode 'Default Values' aktivieren", + 'HELP_SHOP_MODULE_'.Constants::OXID_MODULE_ID.'_blActivateConsentMode' => 'Diese Einstellung ist zu aktivieren, wenn Sie den Google-Consent-Mode ( Einwilligungsmodus ) verwenden wollen.
"Im Einwilligungsmodus können Sie Google über den Cookie- oder App-ID-Einwilligungsstatus Ihrer Nutzer informieren. Mit Tags wird das Verhalten angepasst. Dabei werden die Einstellungen der Nutzer berücksichtigt." ~ Google Einwilligungsmodus', diff --git a/metadata.php b/metadata.php index 48daa2f..acd1bc1 100755 --- a/metadata.php +++ b/metadata.php @@ -170,66 +170,66 @@ $aModule = [ ], 'settings' => [ [ - 'group' => 'd3_gtm_settings', - 'name' => 'd3_gtm_sContainerID', - 'type' => 'str', - 'value' => 'GTM-', - 'position' => 0 + 'group' => Constants::OXID_MODULE_ID.'_settings', + 'name' => Constants::OXID_MODULE_ID.'_sContainerID', + 'type' => 'str', + 'value' => 'GTM-', + 'position' => 0 ], [ - 'group' => 'd3_gtm_settings', - 'name' => 'd3_gtm_blGA4enab', - 'type' => 'bool', - 'value' => true, - 'position' => 1 + 'group' => Constants::OXID_MODULE_ID.'_settings', + 'name' => Constants::OXID_MODULE_ID.'_blGA4enab', + 'type' => 'bool', + 'value' => true, + 'position' => 1 ], [ - 'group' => 'd3_gtm_settings', - 'name' => 'd3_gtm_blEnableDebug', - 'type' => 'bool', - 'value' => false, - 'position' => 999 + 'group' => Constants::OXID_MODULE_ID.'_settings', + 'name' => Constants::OXID_MODULE_ID.'_blEnableDebug', + 'type' => 'bool', + 'value' => false, + 'position' => 999 ], [ - 'group' => 'd3_gtm_settings', - 'name' => 'd3_gtm_blActivateConsentMode', - 'type' => 'bool', - 'value' => false, - 'position' => 999 + 'group' => Constants::OXID_MODULE_ID.'_settings', + 'name' => Constants::OXID_MODULE_ID.'_blActivateConsentMode', + 'type' => 'bool', + 'value' => false, + 'position' => 999 ], [ - 'group' => 'd3_gtm_settings_cookiemanager', - 'name' => 'd3_gtm_settings_hasOwnCookieManager', - 'type' => 'bool', - 'value' => false, - 'position' => 999 + 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', + 'name' => Constants::OXID_MODULE_ID.'_hasOwnCookieManager', + 'type' => 'bool', + 'value' => false, + 'position' => 999 ], [ - 'group' => 'd3_gtm_settings_cookiemanager', - 'name' => 'd3_gtm_settings_controlParameter', - 'type' => 'str', - 'value' => '', - 'position' => 999 + 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', + 'name' => Constants::OXID_MODULE_ID.'_controlParameter', + 'type' => 'str', + 'value' => '', + 'position' => 999 ], [ - 'group' => 'd3_gtm_settings_cookiemanager', - 'name' => 'd3_gtm_settings_HAS_STD_MANAGER', - 'type' => 'select', - 'value' => 'none', + 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', + 'name' => Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER', + 'type' => 'select', + 'value' => 'none', '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' => Constants::OXID_MODULE_ID.'_serversidetagging', + 'name' => Constants::OXID_MODULE_ID.'_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', + 'group' => Constants::OXID_MODULE_ID.'_serversidetagging', + 'name' => Constants::OXID_MODULE_ID.'_serversidetagging_nojs', + 'type' => 'str', + 'value' => 'https://www.googletagmanager.com/ns.html', ], ] ]; \ No newline at end of file From 91e0c5c0c9d70cb72505034726c3500504ee0113 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 11:39:53 +0200 Subject: [PATCH 21/58] [Added] new Admin-UI --- .../Admin/GA4AdminUserInterface_main.php | 97 +++++++++ .../admin/de/d3googleanalytics4_lang.php | 77 +++++++ .../admin/tpl/d3googleanalytics4_main.tpl | 194 ++++++++++++++++++ menu.xml | 8 + metadata.php | 7 + 5 files changed, 383 insertions(+) create mode 100644 Application/Controller/Admin/GA4AdminUserInterface_main.php create mode 100644 Application/views/admin/de/d3googleanalytics4_lang.php create mode 100644 Application/views/admin/tpl/d3googleanalytics4_main.tpl create mode 100644 menu.xml diff --git a/Application/Controller/Admin/GA4AdminUserInterface_main.php b/Application/Controller/Admin/GA4AdminUserInterface_main.php new file mode 100644 index 0000000..f857f2c --- /dev/null +++ b/Application/Controller/Admin/GA4AdminUserInterface_main.php @@ -0,0 +1,97 @@ +addTplParam('d3ConfigObject', $oConf); + $this->addTplParam('d3ViewObject', $this); + $this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList()); + + return $return; + } + + public function save() + { + parent::save(); + + $aParams = Registry::getRequest()->getRequestEscapedParameter('editval'); + + $aCheckBoxParams = [ + '_blEnableGa4', + '_blEnableDebug', + '_blEnableConsentMode', + '_blEnableOwnCookieManager', + ]; + + foreach ($aCheckBoxParams as $checkBoxName){ + if (isset($aParams['bool'][$checkBoxName])){ + $aParams['bool'][$checkBoxName] = true; + }else{ + $aParams['bool'][$checkBoxName] = false; + } + } + + $this->d3SaveShopConfigVars($aParams); + } + + /** + * @param array $aParams + * @return void + */ + protected function d3SaveShopConfigVars(array $aParams) + { + $oConfig = Registry::getConfig(); + foreach ($aParams as $sConfigType => $aConfigParams) { + foreach ($aConfigParams as $sParamName => $sParamValue){ + if($this->d3GetModuleConfigParam($sParamName) !== $sParamValue){ + $oConfig->saveShopConfVar( + $sConfigType, + Constants::OXID_MODULE_ID.$sParamName, + $sParamValue, + $oConfig->getShopId(), + Constants::OXID_MODULE_ID + ); + } + } + } + } + + /** + * @param array $postArray + * @param array $toExcludeArray + * @return array + */ + public function clearOffPostParams(array $postArray, array $toExcludeArray) :array + { + foreach ($toExcludeArray as $excludeThis){ + if (in_array($excludeThis, array_keys($postArray))){ + unset($postArray[$excludeThis]); + } + } + + return $postArray; + } + + /** + * @param string $configParamName + * @return mixed + */ + public function d3GetModuleConfigParam(string $configParamName) + { + return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); + } +} \ No newline at end of file diff --git a/Application/views/admin/de/d3googleanalytics4_lang.php b/Application/views/admin/de/d3googleanalytics4_lang.php new file mode 100644 index 0000000..fcdcaea --- /dev/null +++ b/Application/views/admin/de/d3googleanalytics4_lang.php @@ -0,0 +1,77 @@ + 'UTF-8', + + 'd3mxgoogleanalytics4' => 'Google Analytics 4', + 'd3mxgoogleanalytics4set' => 'Modulverwaltung', + + // Base Translations + 'D3BASECONFIG' => 'Grundeinstellungen', + 'D3CLOSE' => 'Schließen', + 'D3NONE' => '- keinen -', + 'D3CONTAINERID' => 'Container-ID', + 'D3ACTIVATEMOD' => 'Modul aktivieren', + 'D3CNTRLPARAM' => 'Steuerungsparameter', + + // Use debug mode? + 'D3USEDEBUGMODE' => "Debug-Modus aktivieren", + + // Use Consentmode? + 'D3USEGOOGLECONSENTMODE' => "Google Consent Mode 'Default Values' akivieren", + + // Use CMP? + 'D3CMPTABTITLE' => 'Cookie Manager Einstellungen', + 'D3CMPUSEQ' => 'Cookie Manager nutzen?', + 'D3CMP' => 'Consent Management Platform ( CMP )', + + // Additional Config + // Server-Side tagging + 'D3SERVERSIDETAGGING' => 'Server-Side tagging', + 'D3DETAILED_DESC' => 'Detailliertere Erklärung der Funktion', + 'D3SERVERSIDETAGGING_HINT' => 'Die Conatiner-ID wird weiterhin unter "Grundeinstellungen" eingetragen!

+ "Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.
+ Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.
+ Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können."
+
+ - Quelle Developers-Google Server-Side tagging
+
+ Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen! Gegebenenfalls fragen Sie einen technischen Ansprechpartner. + ', + 'D3SERVERSIDETAGGING_TITLE_ACTIVE' => 'Ausführender code', + 'D3SERVERSIDETAGGING_ACTIVE' => 'Diese Domain wird im aktiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag script handelt. + Dieses kümmert sich darum, dass die im DataLayer + zusammengefassten Daten an den GTM weitergeleitet werden.
+
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+https://www.googletagmanager.com/gtm.js?id=
+
+Nachher:
+{Domain}?id=
+
+                                                                        
', + 'D3SERVERSIDETAGGING_TITLE_PASSIVE' => 'nicht Ausführneder code', + 'D3SERVERSIDETAGGING_PASSIVE' => 'Diese Domain wird im passiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag noscript handelt. + Dieses wird ausgeführt, wenn aus einem bestimmten Grund + das Javascript nicht ausgeführt wird.
+ ( keine Cookies erlaubt, JavaScript-Unterbindung, ... ) +
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+src="https://www.googletagmanager.com/ns.html?id={Container-ID}"
+
+Nachher:
+src="{Domain}?id={Container-ID}"
+
+                                                                        
', +); \ No newline at end of file diff --git a/Application/views/admin/tpl/d3googleanalytics4_main.tpl b/Application/views/admin/tpl/d3googleanalytics4_main.tpl new file mode 100644 index 0000000..4d5e180 --- /dev/null +++ b/Application/views/admin/tpl/d3googleanalytics4_main.tpl @@ -0,0 +1,194 @@ +[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] + + + + + +[{if $readonly}] + [{assign var="readonly" value="readonly disabled"}] + [{else}] + [{assign var="readonly" value=""}] + [{/if}] + +
+
+
+
+ [{$oViewConf->getHiddenSid()}] + + + + +
+
+ [{oxmultilang ident="D3BASECONFIG"}] +
+
+
+ d3GetModuleConfigParam('_blEnableGa4')}]checked[{/if}] id="blGA4enab"> + +
+
+ [{oxmultilang ident="D3CONTAINERID"}] + +
+
+ d3GetModuleConfigParam('_blEnableDebug')}]checked[{/if}]> + +
+
+ d3GetModuleConfigParam('_blEnableConsentMode')}]checked[{/if}]> + +
+
+ +
+
+
+
+
+
+

+ +

+
+
+
+ d3GetModuleConfigParam('_blEnableOwnCookieManager')}]checked[{/if}]> + +
+
+ [{oxmultilang ident="D3CNTRLPARAM"}] + +
+ + +
+
+
+
+

+ +

+
+
+
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_HINT"}] +
+
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_TITLE_ACTIVE"}] + +
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_TITLE_PASSIVE"}] + +
+ +
+ + + + +
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/menu.xml b/menu.xml new file mode 100644 index 0000000..9096fa4 --- /dev/null +++ b/menu.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/metadata.php b/metadata.php index acd1bc1..d78eefd 100755 --- a/metadata.php +++ b/metadata.php @@ -1,5 +1,6 @@ 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', + 'controllers' => [ + 'd3googleanalytics4_main' => GA4AdminUserInterfaceMainController::class + ], 'extend' => [ // Core OEViewConfig::class => ViewConfig::class, @@ -93,6 +97,9 @@ $aModule = [ 'page/account/d3gtmnoticelist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmnoticelist.tpl', 'page/account/d3gtmrecommendationlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmrecommendationlist.tpl', 'page/account/d3gtmwishlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmwishlist.tpl', + + // Admin Templates + 'ga4/admin/d3ga4uimain.tpl' => 'd3/googleanalytics4/Application/views/admin/tpl/d3googleanalytics4_main.tpl', ], 'blocks' => [ // tag manager js From 7ab62493e40913e86021f42202d0ccff78122e79 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 11:59:38 +0200 Subject: [PATCH 22/58] [Changed] configParamGetter --- .../Admin/GA4AdminUserInterface_main.php | 3 +- Application/Model/ManagerHandler.php | 2 +- Modules/Core/ViewConfig.php | 42 ++++++++----------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Application/Controller/Admin/GA4AdminUserInterface_main.php b/Application/Controller/Admin/GA4AdminUserInterface_main.php index f857f2c..ee1d242 100644 --- a/Application/Controller/Admin/GA4AdminUserInterface_main.php +++ b/Application/Controller/Admin/GA4AdminUserInterface_main.php @@ -7,6 +7,7 @@ namespace D3\GoogleAnalytics4\Application\Controller\Admin; use D3\GoogleAnalytics4\Application\Model\Constants; use D3\GoogleAnalytics4\Application\Model\ManagerTypes; use OxidEsales\Eshop\Core\Registry; +use OxidEsales\Eshop\Core\ViewConfig; class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController { @@ -92,6 +93,6 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle */ public function d3GetModuleConfigParam(string $configParamName) { - return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); + return Registry::get(ViewConfig::class)->d3GetModuleConfigParam($configParamName); } } \ No newline at end of file diff --git a/Application/Model/ManagerHandler.php b/Application/Model/ManagerHandler.php index ef64abc..4fa4035 100644 --- a/Application/Model/ManagerHandler.php +++ b/Application/Model/ManagerHandler.php @@ -34,7 +34,7 @@ class ManagerHandler */ public function getModuleSettingExplicitManagerSelectValue() :string { - return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER'); + return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER'); } /** diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 670d1cc..685ca34 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -34,10 +34,7 @@ class ViewConfig extends ViewConfig_parent { if ($this->sContainerId === null) { - $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_sContainerID', Constants::OXID_MODULE_ID); + $this->sContainerId = $this->d3GetModuleConfigParam("_sContainerID"); } return $this->sContainerId; } @@ -60,7 +57,7 @@ class ViewConfig extends ViewConfig_parent */ public function shallUseOwnCookieManager() :bool { - return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager'); + return (bool) $this->d3GetModuleConfigParam('_blEnableOwnCookieManager'); } /** @@ -78,7 +75,7 @@ class ViewConfig extends ViewConfig_parent $this->defineCookieManagerType(); - $sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_controlParameter')); + $sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter')); // Netensio Cookie Manager if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) { @@ -120,7 +117,7 @@ class ViewConfig extends ViewConfig_parent */ public function getGtmScriptAttributes() :string { - $sControlParameter = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_controlParameter')); + $sControlParameter = trim($this->d3GetModuleConfigParam('_sControlParameter')); if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){ return ""; @@ -160,10 +157,7 @@ class ViewConfig extends ViewConfig_parent { if ($this->blGA4enabled === null) { - $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_blEnableGA4', Constants::OXID_MODULE_ID); + $this->sContainerId = $this->d3GetModuleConfigParam("d3_gtm_blEnableGA4"); } return $this->blGA4enabled; @@ -171,10 +165,7 @@ class ViewConfig extends ViewConfig_parent public function isGtmConsentModeSetActivated() :bool { - return $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_blActivateConsentMode', Constants::OXID_MODULE_ID); + return $this->sContainerId = $this->d3GetModuleConfigParam("_blEnableConsentMode"); } public function getGtmDataLayer() @@ -216,7 +207,7 @@ class ViewConfig extends ViewConfig_parent public function isDebugModeOn() :bool { - return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug'); + return $this->d3GetModuleConfigParam("_blEnableDebug"); } public function isPromotionList($listId) @@ -232,10 +223,7 @@ class ViewConfig extends ViewConfig_parent */ public function getServerSidetaggingJsDomain() :string { - return ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_js', Constants::OXID_MODULE_ID); + return $this->d3GetModuleConfigParam("_sServersidetagging_js"); } /** @@ -245,9 +233,15 @@ class ViewConfig extends ViewConfig_parent */ public function getServerSidetaggingNoJsDomain() :string { - return ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_nojs', Constants::OXID_MODULE_ID); + return $this->d3GetModuleConfigParam('_sServersidetagging_nojs'); + } + + /** + * @param string $configParamName + * @return mixed + */ + public function d3GetModuleConfigParam(string $configParamName) + { + return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); } } \ No newline at end of file From 54d6918fcf85aed09194818557233e3d7136c452 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 12:00:07 +0200 Subject: [PATCH 23/58] [Removed] deprecated and obsolete module-settings --- metadata.php | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/metadata.php b/metadata.php index d78eefd..00df082 100755 --- a/metadata.php +++ b/metadata.php @@ -174,69 +174,5 @@ $aModule = [ 'file' => '/Application/views/blocks/remove_from_cart.tpl', 'position' => 150 ] - ], - 'settings' => [ - [ - 'group' => Constants::OXID_MODULE_ID.'_settings', - 'name' => Constants::OXID_MODULE_ID.'_sContainerID', - 'type' => 'str', - 'value' => 'GTM-', - 'position' => 0 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_settings', - 'name' => Constants::OXID_MODULE_ID.'_blGA4enab', - 'type' => 'bool', - 'value' => true, - 'position' => 1 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_settings', - 'name' => Constants::OXID_MODULE_ID.'_blEnableDebug', - 'type' => 'bool', - 'value' => false, - 'position' => 999 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_settings', - 'name' => Constants::OXID_MODULE_ID.'_blActivateConsentMode', - 'type' => 'bool', - 'value' => false, - 'position' => 999 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', - 'name' => Constants::OXID_MODULE_ID.'_hasOwnCookieManager', - 'type' => 'bool', - 'value' => false, - 'position' => 999 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', - 'name' => Constants::OXID_MODULE_ID.'_controlParameter', - 'type' => 'str', - 'value' => '', - 'position' => 999 - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_cookiemanager', - 'name' => Constants::OXID_MODULE_ID.'_HAS_STD_MANAGER', - 'type' => 'select', - 'value' => 'none', - 'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT', - ], - // OST929760 - Erweiterung für Serverside Tagging - [ - 'group' => Constants::OXID_MODULE_ID.'_serversidetagging', - 'name' => Constants::OXID_MODULE_ID.'_serversidetagging_js', - 'type' => 'str', - 'value' => 'https://www.googletagmanager.com/gtm.js', - ], - [ - 'group' => Constants::OXID_MODULE_ID.'_serversidetagging', - 'name' => Constants::OXID_MODULE_ID.'_serversidetagging_nojs', - 'type' => 'str', - 'value' => 'https://www.googletagmanager.com/ns.html', - ], ] ]; \ No newline at end of file From 09ccb6726de506421b565b6e30424fb9cfebf92d Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 12:05:32 +0200 Subject: [PATCH 24/58] [Changed] clear dead code --- .../Admin/GA4AdminUserInterface_main.php | 18 ------------------ Application/Model/ManagerHandler.php | 2 ++ Modules/Core/ViewConfig.php | 6 ------ 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/Application/Controller/Admin/GA4AdminUserInterface_main.php b/Application/Controller/Admin/GA4AdminUserInterface_main.php index ee1d242..019f46a 100644 --- a/Application/Controller/Admin/GA4AdminUserInterface_main.php +++ b/Application/Controller/Admin/GA4AdminUserInterface_main.php @@ -17,8 +17,6 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle { $return = parent::render(); - $oConf = Registry::getConfig(); - $this->addTplParam('d3ConfigObject', $oConf); $this->addTplParam('d3ViewObject', $this); $this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList()); @@ -71,22 +69,6 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle } } - /** - * @param array $postArray - * @param array $toExcludeArray - * @return array - */ - public function clearOffPostParams(array $postArray, array $toExcludeArray) :array - { - foreach ($toExcludeArray as $excludeThis){ - if (in_array($excludeThis, array_keys($postArray))){ - unset($postArray[$excludeThis]); - } - } - - return $postArray; - } - /** * @param string $configParamName * @return mixed diff --git a/Application/Model/ManagerHandler.php b/Application/Model/ManagerHandler.php index 4fa4035..c207359 100644 --- a/Application/Model/ManagerHandler.php +++ b/Application/Model/ManagerHandler.php @@ -8,6 +8,8 @@ use OxidEsales\Eshop\Core\ViewConfig; class ManagerHandler { /** + * Gets current chosen Manager + * * @return string */ public function getCurrManager() :string diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 685ca34..46f8681 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -210,12 +210,6 @@ class ViewConfig extends ViewConfig_parent return $this->d3GetModuleConfigParam("_blEnableDebug"); } - public function isPromotionList($listId) - { - $oConfig = Registry::getConfig(); - $aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross']; - } - /** * @return string * @throws ContainerExceptionInterface From 4a4b3283642f0a6670773fe80bd6b76e2d80502e Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 12:15:55 +0200 Subject: [PATCH 25/58] [Fixed] false class-property declaration --- Modules/Core/ViewConfig.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 46f8681..282671e 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -28,7 +28,12 @@ class ViewConfig extends ViewConfig_parent // Google Tag Manager Container ID private $sContainerId = null; - private $sCookieManagerType = null; + + // used CMP + private $sCookieManagerType = null;# + + // isModule Activated properly? + private $blGA4enabled = null; public function getGtmContainerId() { @@ -147,8 +152,6 @@ class ViewConfig extends ViewConfig_parent return ""; } - private $blGA4enabled = null; - /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface @@ -157,7 +160,7 @@ class ViewConfig extends ViewConfig_parent { if ($this->blGA4enabled === null) { - $this->sContainerId = $this->d3GetModuleConfigParam("d3_gtm_blEnableGA4"); + $this->blGA4enabled = $this->d3GetModuleConfigParam("_blEnableGA4"); } return $this->blGA4enabled; @@ -165,7 +168,7 @@ class ViewConfig extends ViewConfig_parent public function isGtmConsentModeSetActivated() :bool { - return $this->sContainerId = $this->d3GetModuleConfigParam("_blEnableConsentMode"); + return $this->d3GetModuleConfigParam("_blEnableConsentMode"); } public function getGtmDataLayer() From ef29f7eb1bc4ec3c9630c3c091316421de2570b3 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 12:16:22 +0200 Subject: [PATCH 26/58] [Added] additional check for properly activated module --- Application/views/blocks/_gtm_js.tpl | 2 +- Modules/Core/ViewConfig.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Application/views/blocks/_gtm_js.tpl b/Application/views/blocks/_gtm_js.tpl index 4ff4f37..5c4751c 100755 --- a/Application/views/blocks/_gtm_js.tpl +++ b/Application/views/blocks/_gtm_js.tpl @@ -5,7 +5,7 @@ [{assign var="d3GtmContainerIdString" value=$oViewConf->getGtmContainerId()}] -[{if $oViewConf->D3blShowGtmScript()}] +[{if $oViewConf->isGA4enabled() and $oViewConf->D3blShowGtmScript()}] [{if $d3GtmContainerIdString}] [{strip}] diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 282671e..6e80c00 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -73,6 +73,10 @@ class ViewConfig extends ViewConfig_parent /** @var Config $oConfig */ $oConfig = Registry::getConfig(); + if (false === $this->isGA4enabled()){ + return false; + } + // No Cookie Manager in use if (!$this->shallUseOwnCookieManager()) { return true; From cb9cd11ff515e102a59991308967685a877eb96e Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 13:54:00 +0200 Subject: [PATCH 27/58] [Changed] template code upgrade change generic-html-tag id and controll names to specified names --- Application/views/admin/tpl/d3googleanalytics4_main.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/views/admin/tpl/d3googleanalytics4_main.tpl b/Application/views/admin/tpl/d3googleanalytics4_main.tpl index 4d5e180..3878aea 100644 --- a/Application/views/admin/tpl/d3googleanalytics4_main.tpl +++ b/Application/views/admin/tpl/d3googleanalytics4_main.tpl @@ -59,11 +59,11 @@

-

-
+
d3GetModuleConfigParam('_blEnableOwnCookieManager')}]checked[{/if}]> @@ -89,11 +89,11 @@

-

-
+
From 8e52b0541ad767b4e716b06b9b4de420c2851584 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 15:48:29 +0200 Subject: [PATCH 28/58] [Added] admin headitem alternative --- .../admin/tpl/d3googleanalytics4_headitem.tpl | 108 ++++++++++++++++++ .../admin/tpl/d3googleanalytics4_main.tpl | 2 +- metadata.php | 1 + 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 Application/views/admin/tpl/d3googleanalytics4_headitem.tpl diff --git a/Application/views/admin/tpl/d3googleanalytics4_headitem.tpl b/Application/views/admin/tpl/d3googleanalytics4_headitem.tpl new file mode 100644 index 0000000..1cc5d7a --- /dev/null +++ b/Application/views/admin/tpl/d3googleanalytics4_headitem.tpl @@ -0,0 +1,108 @@ + + + + [{$title}] + + [{if isset($meta_refresh_sec,$meta_refresh_url)}] + + [{/if}] + + + [{block name="admin_headitem_inccss"}] + + + + [{/block}] + + [{block name="admin_headitem_incjs"}] + + + + [{/block}] + + [{block name="admin_headitem_js"}] + + [{/block}] + + + +[{include file="tooltips.tpl"}] +
+ +
+ [{include file="inc_error.tpl" Errorlist=$Errors.default}] + + +
+
+
\ No newline at end of file diff --git a/Application/views/admin/tpl/d3googleanalytics4_main.tpl b/Application/views/admin/tpl/d3googleanalytics4_main.tpl index 3878aea..869d44f 100644 --- a/Application/views/admin/tpl/d3googleanalytics4_main.tpl +++ b/Application/views/admin/tpl/d3googleanalytics4_main.tpl @@ -1,4 +1,4 @@ -[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] +[{include file="ga4/admin/d3ga4uiheaditem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]