From bfc2ca8ad6428ae082e22d3a1ac30b5c8763fe9a Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 21 Jun 2023 14:19:48 +0200 Subject: [PATCH 01/21] adjust view_item_list add categories to ecommerce-DataLayer --- Application/views/ga4/view_item_list.tpl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Application/views/ga4/view_item_list.tpl b/Application/views/ga4/view_item_list.tpl index 04a225f..5900f40 100644 --- a/Application/views/ga4/view_item_list.tpl +++ b/Application/views/ga4/view_item_list.tpl @@ -1,5 +1,6 @@ [{$smarty.block.parent}] [{assign var="gtmProducts" value=$oView->getArticleList()}] +[{assign var="gtmCategory" value=$oView->getActiveCategory()}] [{assign var="breadCrumb" value=''}] @@ -8,12 +9,19 @@ -[{/strip}] +[{$smarty.block.parent}] + +[{strip}] + +[{/strip}] diff --git a/metadata.php b/metadata.php index 805c2ac..5189199 100755 --- a/metadata.php +++ b/metadata.php @@ -63,7 +63,7 @@ $aModule = [ [ 'template' => 'page/checkout/thankyou.tpl', 'block' => 'checkout_thankyou_main', - 'file' => '/Application/views/blocks/checkout_s5.tpl' + 'file' => '/Application/views/blocks/purchase.tpl' ], // Lists // view_item_list From 429069e0cf1d48c9976a53b02c9ad9d5f38d39a0 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 21 Jun 2023 15:56:58 +0200 Subject: [PATCH 09/21] fix wrong var usage --- Application/views/blocks/view_cart.tpl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Application/views/blocks/view_cart.tpl b/Application/views/blocks/view_cart.tpl index e879e19..5672c28 100644 --- a/Application/views/blocks/view_cart.tpl +++ b/Application/views/blocks/view_cart.tpl @@ -20,17 +20,17 @@ [{assign var="gtmBasketItem" value=$basketitem->getArticle()}] [{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}] { - 'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]', - 'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]', - 'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]', - 'item_category':'[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]', - 'item_category_2':'[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]', - 'item_category_3':'[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]', - 'item_category_4':'[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]', - 'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]', - 'price': [{$d3oItemPrice->getPrice()}], - 'quantity':[{$basketitem->getAmount()}], - 'position':[{$smarty.foreach.gtmCartContents.index}] + 'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]', + 'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]', + 'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]', + 'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]', + 'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]', + 'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]', + 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]', + 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', + 'price': [{$d3oItemPrice->getPrice()}], + 'quantity': [{$basketitem->getAmount()}], + 'position': [{$smarty.foreach.gtmCartContents.index}] }[{if !$smarty.foreach.gtmCartContents.last}],[{/if}] [{/foreach}] ] From 8a7c25fad96c6c7bbfac45192663a95f5dfc84cd Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 21 Jun 2023 15:58:46 +0200 Subject: [PATCH 10/21] [working state] add method for article category steps change naming of vars Not working yet: getting of category-steps --- Application/views/blocks/purchase.tpl | 28 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Application/views/blocks/purchase.tpl b/Application/views/blocks/purchase.tpl index b815a92..04dd350 100644 --- a/Application/views/blocks/purchase.tpl +++ b/Application/views/blocks/purchase.tpl @@ -18,16 +18,24 @@ 'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]', 'items': [ - [{foreach from=$gtmArticles item="d3BasketArticle" name="gtmArticles"}] - [{assign var="d3oArticlePrice" value=$d3BasketArticle->getPrice()}] - { - 'id': '[{$d3BasketArticle->getFieldData("oxartnum")}]', - 'name': '[{$d3BasketArticle->getFieldData("oxtitle")}]', - 'variant': '[{$d3BasketArticle->getFieldData("oxselvariant")}]', - 'price': [{$d3oArticlePrice->getPrice()}], - 'quantity': [{$d3BasketArticle->getFieldData("oxamount")}], - 'position': [{$smarty.foreach.gtmArticles.iteration}] - }[{if !$smarty.foreach.gtmArticles.last}],[{/if}] + [{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}] + [{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}] + [{assign var="gtmPurchaseItemCategory" value=$gtmBasketItem->getCategory()}] + { + 'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]', + 'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]', + 'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]', + 'coupon': '[{$gtmBasketItem->getFieldData("oxtitle")}]', + 'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]', + 'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]', + 'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]', + 'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]', + 'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]', + 'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]', + 'price': [{$gtmPurchaseItemPriceObject->getPrice()}], + 'quantity': [{$gtmBasketItem->getFieldData("oxamount")}], + 'position': [{$smarty.foreach.gtmArticles.iteration}] + }[{if !$smarty.foreach.gtmArticles.last}],[{/if}] [{/foreach}] ] } From 5c53d83f32d48f0752b9175bb5d3997fed7c34ac Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 22 Jun 2023 09:39:03 +0200 Subject: [PATCH 11/21] [finished] item_category added to purchase-Event --- Application/views/blocks/purchase.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Application/views/blocks/purchase.tpl b/Application/views/blocks/purchase.tpl index 04dd350..f43c1d1 100644 --- a/Application/views/blocks/purchase.tpl +++ b/Application/views/blocks/purchase.tpl @@ -20,7 +20,9 @@ [ [{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}] [{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}] - [{assign var="gtmPurchaseItemCategory" value=$gtmBasketItem->getCategory()}] + [{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}] + [{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}] + { 'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]', 'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]', From fec30b1109c98235203ad2c00693f92bd2ca28c1 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 22 Jun 2023 09:57:14 +0200 Subject: [PATCH 12/21] add coupon to puchase-event --- Application/views/blocks/purchase.tpl | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Application/views/blocks/purchase.tpl b/Application/views/blocks/purchase.tpl index f43c1d1..4d26b29 100644 --- a/Application/views/blocks/purchase.tpl +++ b/Application/views/blocks/purchase.tpl @@ -3,21 +3,24 @@ [{strip}] From d2ef663dd30951815adca763573ebb696416b80a Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Thu, 22 Jun 2023 10:37:09 +0200 Subject: [PATCH 13/21] add paymentType to puchase-event extend Basket-Model to add method to get payment-desc --- Application/views/blocks/purchase.tpl | 6 +++--- IntelliSenseHelper.php | 1 + Modules/Application/Model/Basket.php | 23 +++++++++++++++++++++++ metadata.php | 5 ++++- 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 Modules/Application/Model/Basket.php diff --git a/Application/views/blocks/purchase.tpl b/Application/views/blocks/purchase.tpl index 4d26b29..b97219e 100644 --- a/Application/views/blocks/purchase.tpl +++ b/Application/views/blocks/purchase.tpl @@ -4,8 +4,8 @@ [{if $oViewConf->D3blShowGtmScript()}] - [{if $oViewConf->getGtmContainerId()}][{strip}] - - - - - [{if $oViewConf->getTopActionClassName() === "alist" }] - [{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}] - [{elseif $oViewConf->getTopActionClassName() === "details" }] - [{* include file="ga4_view_item.tpl" gtmProduct=$oView->getProduct() *}] - [{elseif $oViewConf->getTopActionClassName() === "search" }] - [{elseif $oViewConf->getTopActionClassName() === "basket" }] - [{/if}] - [{/strip}][{/if}] + [{if $oViewConf->getGtmContainerId()}] + [{strip}] + + + + [{/strip}] [{/if}] +[{/if}] [{$smarty.block.parent}] \ No newline at end of file diff --git a/metadata.php b/metadata.php index 917c04e..d04f484 100755 --- a/metadata.php +++ b/metadata.php @@ -22,7 +22,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.7.0', + 'version' => '2.8.0', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', @@ -31,11 +31,7 @@ $aModule = [ OECategory::class => Category::class, OEBasket::class => Basket::class ], - 'templates' => [ - // GA4 events - 'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl', - 'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl', - ], + 'templates' => [], 'blocks' => [ // tag manager js [ From 0ec765955e6af61770254cc57df983562da3c1a7 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Fri, 23 Jun 2023 15:15:42 +0200 Subject: [PATCH 16/21] bump version && changelog to 2.8.0 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6c0fa..28d8acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ 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.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-23 +### Added +- Method to get the in order used Payment-Name +- Method to get the current Article Category +- Following Entries to dedicated event-templates + - coupon + - paymentType + - item_list_name + - item_category +### Changed +- all used template-files have a more dedicated name +- general code cleanup + ## [2.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.6.0...2.7.0) - 2023-06-19 ### Changed - add_to_cart event template-structure From ab4232fb4a09e9f6773e8990b2d9a76ad9011598 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 27 Jun 2023 08:33:49 +0200 Subject: [PATCH 17/21] add cookiefirst to manager-list --- Application/Model/ManagerTypes.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Application/Model/ManagerTypes.php b/Application/Model/ManagerTypes.php index 7ebda76..01c9db5 100644 --- a/Application/Model/ManagerTypes.php +++ b/Application/Model/ManagerTypes.php @@ -34,6 +34,8 @@ class ManagerTypes const CONSENTMANAGER = "CONSENTMANAGER"; + const COOKIEFIRST = "COOKIEFIRST"; + /** * @return array */ @@ -45,7 +47,8 @@ class ManagerTypes "net_cookie_manager" => self::NET_COOKIE_MANAGER, "oxps_usercentrics" => self::USERCENTRICS_MODULE, "usercentrics" => self::USERCENTRICS_MANUALLY, - "consentmanager" => self::CONSENTMANAGER + "consentmanager" => self::CONSENTMANAGER, + "cookiefirst" => self::COOKIEFIRST ]; } From 0ae67c823bb91c6f4d74f8028793510edc1bdb83 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 27 Jun 2023 08:46:39 +0200 Subject: [PATCH 18/21] add metadata cookiefirst entry plus multilang-usability --- Application/views/admin/de/module_options.php | 7 +++++++ metadata.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Application/views/admin/de/module_options.php b/Application/views/admin/de/module_options.php index 6f09746..76204bd 100755 --- a/Application/views/admin/de/module_options.php +++ b/Application/views/admin/de/module_options.php @@ -31,10 +31,17 @@ $aLang = [ // 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
+ 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?
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_cookieName' => 'CookieID', ]; diff --git a/metadata.php b/metadata.php index d04f484..c14eadf 100755 --- a/metadata.php +++ b/metadata.php @@ -128,7 +128,7 @@ $aModule = [ 'name' => 'd3_gtm_settings_HAS_STD_MANAGER', 'type' => 'select', 'value' => 'none', - 'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS', + 'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST', ], ] ]; \ No newline at end of file From 54fcbf88c9ebad9974a3c06590654034869caf4b Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 27 Jun 2023 08:46:51 +0200 Subject: [PATCH 19/21] add cookiefirst necessary script-attributes --- Modules/Core/ViewConfig.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index f2a2a64..d73af43 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -115,8 +115,7 @@ class ViewConfig extends ViewConfig_parent */ public function getGtmScriptAttributes() :string { - $oConfig = Registry::getConfig(); - $sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName'); + $sCookieId = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_cookieName')); if (false === $this->shallUseOwnCookieManager()){ return ""; @@ -144,6 +143,10 @@ class ViewConfig extends ViewConfig_parent } } + if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){ + return 'type="text/plain" data-cookiefirst-category="' . $sCookieId .'"'; + } + return ""; } From b0a1c204196c189c722b5fdd125e079a6195b28a Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 27 Jun 2023 08:58:05 +0200 Subject: [PATCH 20/21] add missing cmp-entry in cmp-list --- Modules/Core/ViewConfig.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index d73af43..b40c232 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -75,7 +75,7 @@ class ViewConfig extends ViewConfig_parent $this->defineCookieManagerType(); - $sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName'); + $sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_cookieName')); // Netensio Cookie Manager if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) { @@ -97,6 +97,7 @@ class ViewConfig extends ViewConfig_parent $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER + or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE ) { From 2cc036863324935ba80651796a7757cc095e3b09 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Tue, 27 Jun 2023 09:53:00 +0200 Subject: [PATCH 21/21] bump version and changelog to 2.9.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ metadata.php | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28d8acf..719e895 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.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-27 +### Added +- Cookiefirst usability + ## [2.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-23 ### Added - Method to get the in order used Payment-Name @@ -85,6 +89,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - using of ContainerFactory in ViewConfig +## [1.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.9.0...1.10.0) - 2023-06-27 +### Added +- Following Entries to dedicated event-templates + - coupon + - paymentType + - item_list_name + - item_category +- Method to get the in order used Payment-Name +- Method to get the current Article Category +### Changed +- cookieManager handling +- general template cleanup +- renaming the template to a more intuitive name + +## [1.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.8.0...1.9.0) - 2023-06-19 +### Changed +- add_to_cart event template-structure + ## [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 diff --git a/metadata.php b/metadata.php index c14eadf..3c796c9 100755 --- a/metadata.php +++ b/metadata.php @@ -22,7 +22,7 @@ $aModule = [ Die Entwicklung basiert auf einem Fork von Marat Bedoev - Github-Link ", 'thumbnail' => 'thumbnail.png', - 'version' => '2.8.0', + 'version' => '2.9.0', 'author' => 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/',