Compare commits

...

158 Commits

Author SHA1 Message Date
MaxBUhe 8a643a0b8a Merge remote-tracking branch 'remotes/origin/rel_2.x' 2024-03-08 10:10:27 +01:00
MaxBUhe 7d23204841 Merge remote-tracking branch 'remotes/origin/rel_1.x' 2024-03-08 09:49:12 +01:00
MaxBUhe 9410495a58 [Bump] Metadata && Changelog 2024-02-05 14:12:02 +01:00
MaxBUhe 05df5ef100 [Fix] missing Component-ArticleDetails extension; missing ManufacturerList-Extension 2024-02-05 11:18:15 +01:00
MaxBUhe c7d3671265 [Bump] Changelog && Metadata 2024-01-25 14:50:44 +01:00
MaxBUhe 3621ca606a [Fix] missing Component-ArticleDetails extension; missing ManufacturerList-Extension 2024-01-25 14:49:32 +01:00
MaxBUhe 59ef1d0625 [Added] extended Doks 2024-01-22 14:30:59 +01:00
MaxBUhe e4969f2cbd [Changed] phpstan.neon 2024-01-22 14:23:09 +01:00
MaxBUhe 13ef2bef7b [Changed] phpstan.neon 2024-01-22 11:27:04 +01:00
MaxBUhe 59f0e37cce bump changelog && version to 2.14.0 2024-01-22 11:16:16 +01:00
MaxBUhe bcf38a6e11 Merge remote-tracking branch 'remotes/origin/rel_1.x' into dev_2.x 2024-01-22 11:13:05 +01:00
MaxBUhe 31b3474cfd [Bump] metadata && changelog 2024-01-22 09:09:26 +01:00
MaxBUhe 1a641de8fc [Added] PHPStan lvl 5, error-ignoring; [Fixed] user-Getter evaluation 2024-01-19 11:54:48 +01:00
MaxBUhe 268cf6f6da [Working] set PHPStan to lvl 5 2024-01-17 16:07:41 +01:00
MaxBUhe 5d5b3459cd [Changed] phpStan - set level to 4, clear files by level
Also changed method, to get the category for items (products)
2024-01-17 15:53:51 +01:00
MaxBUhe 1c1080923b [Changed] phpStan - set level to 3, clean files by level 2024-01-17 15:36:43 +01:00
MaxBUhe 007e83909b [Added] search controller extension (add_to_cart) 2024-01-17 15:32:59 +01:00
MaxBUhe e3f4bd16c9 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2024-01-03 13:49:08 +01:00
MaxBUhe ed5fcc6011 bump changelog && version to 2.13.1 2024-01-03 13:48:43 +01:00
MaxBUhe 22ea5a1ce2 [Fixed] error on array-count at zero entries 2024-01-03 13:46:43 +01:00
MaxBUhe 229cf3695f [Changed] template structure, template-structure information
all block extensions now only include the template instead of having the extension included immediately (dedicated event-templates within views/event); information about the structure changed to the correct paths
2024-01-02 16:07:53 +01:00
MaxBUhe a990834da4 [Added] missing IntelliSenseHelper entry for Manufacturer 2024-01-02 13:19:20 +01:00
MaxBUhe 6047f72edf [Added] phpstan + phpstan file 2024-01-02 11:54:07 +01:00
MaxBUhe e2564f613a [Changed] capture implementation
reworked to a safer path-through to get the data
2023-12-18 11:59:12 +01:00
MaxBUhe 9ea5408e44 [Added] add_to_cart to start-template 2023-12-18 11:23:43 +01:00
MaxBUhe ab6b7f7454 [Added] add_to_cart to recommlist, wishlist, noticelist, Class-Extensions for corresponding templates 2023-11-07 15:23:40 +01:00
MaxBUhe a88fa570a8 [Added] add_to_cart to page/list/list.tpl, BasketComponent methods for trigger-behaviour add_to_cart 2023-11-07 11:00:28 +01:00
MaxBUhe 81aab10c4e [Changed] process-list of add_to_cart; [Added] BasketComponent extensions to controll the trigger-behaviour of add_to_cart, ArticleDetailsController extension for add_to_Cart i view_item
add_to_cart no longer is a block extension, changed to an indiv tpl-file
2023-11-07 10:59:39 +01:00
MaxBUhe 5ac3385b53 [Added] add_to_cart to page/list/list.tpl 2023-11-02 13:36:44 +01:00
MaxBUhe 42618fef79 Merge remote-tracking branch 'remotes/origin/rel_2.x'
# Conflicts:
#	Modules/Core/ViewConfig.php
2023-09-13 16:18:43 +02:00
MaxBUhe f02c40cfb7 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
#	Docs/README.md
#	IntelliSenseHelper.php
#	Modules/Core/ViewConfig.php
#	metadata.php
2023-09-13 16:13:03 +02:00
MaxBUhe 5c98d99d80 bump metadata && changelog 2023-09-13 16:02:49 +02:00
MaxBUhe 19553fcee2 bump metadata and readme 2023-09-13 16:00:12 +02:00
MaxBUhe da2966626e cleaning; adjust not set param handling 2023-09-13 15:15:49 +02:00
MaxBUhe 6fcee0671f adjust set-param check 2023-09-13 15:15:22 +02:00
MaxBUhe bb513e6ded adjust set-param check 2023-09-13 15:13:35 +02:00
MaxBUhe f64eb35763 switch control-param name 2023-09-13 15:09:27 +02:00
MaxBUhe 36b3aa9ef2 switch param-name 2023-09-13 15:08:58 +02:00
MaxBUhe b2d8d597fd switch name of control-parameter; switch consentmanager-script-adjustments
# Conflicts:
#	Modules/Core/ViewConfig.php
2023-09-13 15:02:50 +02:00
MaxBUhe 36ac641233 adjust Doku with further infos new cookieid -> Control parameter 2023-09-13 15:00:44 +02:00
MaxBUhe ef4e4625cd switch name of control-parameter; switch consentmanager-script-adjustments 2023-09-13 14:56:05 +02:00
MaxBUhe 84a9aba764 adjust Doku with further infos new cookieid -> Control parameter 2023-09-13 14:42:12 +02:00
MaxBUhe 154147b8d8 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-09-07 15:22:13 +02:00
MaxBUhe 99af4cdfa9 bump metadata && changelog 2023-09-07 15:16:54 +02:00
MaxBUhe eb2c7f73b9 add cookiebot essentials 2023-09-07 15:15:05 +02:00
MaxBUhe 7d12dd68a7 bump metadata && changelog 2023-09-07 15:11:04 +02:00
MaxBUhe 565f47b1ff add cookiebot essentials 2023-09-07 15:08:06 +02:00
MaxBUhe 7c6b0215a5 bump metadata && changelog 2023-08-23 17:16:58 +02:00
Markus Gärtner 84e3895db8 extend Manufacturer 2023-08-23 17:12:18 +02:00
MaxBUhe 1e479503a7 [changed] 'an article has been removed from basket'-check 2023-08-23 17:09:49 +02:00
MaxBUhe 575e35ffbc [changed] 'an article has been removed from basket'-check 2023-08-18 14:07:53 +02:00
MaxBUhe 2e6acbe675 [fixed] metadata class entry 2023-08-17 10:59:57 +02:00
MaxBUhe aae6c43786 extends changelog 2023-08-17 10:30:19 +02:00
MaxBUhe 17840d33b1 Merge remote-tracking branch 'remotes/origin/dev_1.x_manufacturer' into dev_1.x
# Conflicts:
#	metadata.php
2023-08-17 10:27:21 +02:00
MaxBUhe a49c29d7aa add CountryObjectGetter to ThankYouController 2023-08-17 09:20:58 +02:00
MaxBUhe e90aba2c55 add gitignore 2023-08-17 08:53:00 +02:00
MaxBUhe ea6b63fd2f extended docs 2023-08-17 08:53:00 +02:00
MaxBUhe 6b18c50b42 add 'remove_from_cart' event 2023-08-17 08:53:00 +02:00
MaxBUhe 443b456a0d add new method for debug-check 2023-08-17 08:53:00 +02:00
MaxBUhe 216c53fa90 general structure rework, debug_mode setter 2023-08-17 08:52:58 +02:00
MaxBUhe 9e7b4653ea add deug_mode switch 2023-08-16 10:44:50 +02:00
MaxBUhe 7b1241ab97 correct naming in view_search_result 2023-08-16 09:38:03 +02:00
Markus Gärtner 5355b0a7ad extend Manufacturer 2023-08-15 11:59:27 +02:00
MaxBUhe 0f15df8364 [working-state] rebuilding meta structure 2023-08-03 15:55:07 +02:00
MaxBUhe 71b743ddcc bump changelog && version to 2.10.1 2023-08-03 15:10:38 +02:00
MaxBUhe c0206f741f add missing param to check if isRemoveFromCart 2023-08-03 15:09:12 +02:00
MaxBUhe 22bec30621 add remove_from_cart 2023-08-03 14:57:26 +02:00
MaxBUhe 43cdc7e8ae Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-08-02 11:57:26 +02:00
MaxBUhe 49bfd5be09 bump changelog && version to 2.10.0 2023-08-02 11:55:28 +02:00
MaxBUhe 6002540268 bump changelog && version to 2.9.2 2023-06-29 08:33:07 +02:00
MaxBUhe cc89303595 [fix-bug] wrong category method used for check 2023-06-29 08:31:57 +02:00
MaxBUhe 7062d935f4 bump changelog && metadata to 2.9.1 2023-06-27 12:16:43 +02:00
MaxBUhe 9f1deab099 [bug-fix] non-category having articles throw exception
deny method-call on no category
2023-06-27 12:15:21 +02:00
MaxBUhe 461f7f15da 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
#	composer.json
#	metadata.php
2023-06-27 10:03:51 +02:00
MaxBUhe 4f8fa7cdc9 Merge remote-tracking branch 'remotes/origin/rel_2.x'
# Conflicts:
#	CHANGELOG.md
2023-06-27 09:59:00 +02:00
MaxBUhe 2cc0368633 bump version and changelog to 2.9.0 2023-06-27 09:53:00 +02:00
MaxBUhe 432ba54c84 bump version && changelog to 1.10.0 2023-06-27 09:48:29 +02:00
MaxBUhe 8b344ffb85 add cookiefirst 2023-06-27 09:39:43 +02:00
MaxBUhe 0009926313 revert php adjustment in composer.json 2023-06-27 09:30:10 +02:00
MaxBUhe 50be757355 reduce minimal usable php to 7.0 2023-06-27 09:08:17 +02:00
MaxBUhe b0a1c20419 add missing cmp-entry in cmp-list 2023-06-27 08:58:05 +02:00
MaxBUhe 54fcbf88c9 add cookiefirst necessary script-attributes 2023-06-27 08:46:51 +02:00
MaxBUhe 0ae67c823b add metadata cookiefirst entry plus multilang-usability 2023-06-27 08:46:39 +02:00
MaxBUhe ab4232fb4a add cookiefirst to manager-list 2023-06-27 08:33:49 +02:00
MaxBuhe01 60f61f4bab [working state] add rel_2.x adjustments 2023-06-26 17:45:26 +02:00
MaxBuhe01 a93b1cf582 [working state] add rel_2.x adjustments 2023-06-26 17:41:00 +02:00
MaxBUhe 0ec765955e bump version && changelog to 2.8.0 2023-06-23 15:15:42 +02:00
MaxBUhe d505d8530a rm unnecessary code 2023-06-23 15:08:09 +02:00
MaxBUhe fd79710158 add coupon to view_cart 2023-06-22 10:43:50 +02:00
MaxBUhe d2ef663dd3 add paymentType to puchase-event
extend Basket-Model to add method to get payment-desc
2023-06-22 10:37:40 +02:00
MaxBUhe fec30b1109 add coupon to puchase-event 2023-06-22 09:57:30 +02:00
MaxBUhe 5c53d83f32 [finished] item_category added to purchase-Event 2023-06-22 09:39:03 +02:00
MaxBUhe 8a7c25fad9 [working state] add method for article category steps
change naming of vars

Not working yet: getting of category-steps
2023-06-21 15:58:46 +02:00
MaxBUhe 429069e0cf fix wrong var usage 2023-06-21 15:56:58 +02:00
MaxBUhe 50f9fbca23 renaming vars on puchase-tpl 2023-06-21 15:47:06 +02:00
MaxBUhe cb18feba82 add missing item_list_name 2023-06-21 15:45:12 +02:00
MaxBUhe 47b8622018 implementing Category->getSplitCategoryArray() method for category-step 2023-06-21 15:43:43 +02:00
MaxBUhe 92a91d0194 implementing Category->getSplitCategoryArray() method for category-step 2023-06-21 15:33:38 +02:00
MaxBUhe 226a80f138 implementing Category->getSplitCategoryArray() method for category-step 2023-06-21 15:29:27 +02:00
MaxBUhe 5dd7b51fb5 adjust view_cart; extend Model\Category
add categories to ecommerce-DataLayer; add method to immediately get the requested Category-Steps
2023-06-21 15:23:50 +02:00
MaxBUhe 7b82476e8b adjust view_item
add categories to ecommerce-DataLayer
2023-06-21 14:24:47 +02:00
MaxBUhe bfc2ca8ad6 adjust view_item_list
add categories to ecommerce-DataLayer
2023-06-21 14:19:48 +02:00
MaxBUhe 7266416fe4 Merge remote-tracking branch 'remotes/origin/rel_2.x'
# Conflicts:
#	metadata.php
2023-06-19 15:25:00 +02:00
MaxBUhe 389d4f44ed Merge remote-tracking branch 'remotes/origin/rel_1.x'
# Conflicts:
#	CHANGELOG.md
#	metadata.php
2023-06-19 15:23:42 +02:00
MaxBUhe e48b21022c bump version && changelog to 2.7.0 2023-06-19 15:17:43 +02:00
MaxBUhe b4bf91660e [rework] change structure of GA-event
moving the procedere into one step so there's not an accidental triggering of an GA-Push-Event which at the end overwrites the View-Item-Push-Event in the cmpEvent
2023-06-19 14:57:12 +02:00
MaxBUhe 3f59d1f210 bump version && changelog to 1.9.0 2023-06-19 14:50:34 +02:00
MaxBUhe 5ed924e840 [rework] change structure of GA-event
moving the procedere into one step so there's not an accidental triggering of an GA-Push-Event which at the end overwrites the View-Item-Push-Event in the cmpEvent
2023-06-19 11:34:45 +02:00
MaxBUhe 3d62993dfc add missing consentmanager readme entry 2023-06-01 14:19:29 +02:00
MaxBUhe 41d6e94fa7 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-05-31 14:55:26 +02:00
MaxBUhe b8e2aeaa58 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
2023-05-31 14:51:07 +02:00
MaxBUhe 679a49823c add missing changelog 1.x changes 2023-05-31 14:33:49 +02:00
MaxBUhe 106fea9c91 fix explicit manager bug
bug would make script apply anyway, even if no manager is found
2023-05-31 14:29:46 +02:00
MaxBUhe d4ef0f35f9 bump version && changelog to 1.8.0 2023-05-31 14:22:11 +02:00
MaxBUhe c17ae1cef5 fix explicit manager bug
bug would adjust the script even if the check for an own cookieManager is not set
2023-05-31 14:11:50 +02:00
MaxBUhe 13132e6da0 Merge branch 'rel_2_prep_porting_rel_1.x' of git.d3data.de:D3Public/GoogleAnalytics4 into rel_2_prep_porting_rel_1.x 2023-05-31 13:42:54 +02:00
MaxBUhe 5c478124bc bump version && changelog to 2.6.0 2023-05-31 13:40:51 +02:00
MaxBUhe 12613357b3 bump version && changelog to 2.6.0 2023-05-31 13:38:32 +02:00
MaxBUhe 95e0cab68c rework 'Manager Type Handling'; add ManagerHandler + ManagerTypes 2023-05-31 12:17:00 +02:00
MaxBUhe 1d194d445a rm unnecessary check 2023-05-31 12:16:10 +02:00
MaxBUhe bf3fee5ce5 add missing article-getter 2023-05-31 10:35:18 +02:00
MaxBUhe 3c280a3adb adjust readme and switch used block-extension 2023-05-31 10:34:34 +02:00
MaxBUhe 6217524828 adjusted usercentrics script 2023-05-31 10:34:24 +02:00
MaxBUhe 5ef600ff2a added position to block-extension 2023-05-31 10:34:14 +02:00
MaxBUhe a40d922f42 [working-state] restructuring usercentricts & consentmanager decision
consentmanager decision is working so far; next step is implementing usercentricts
2023-05-31 10:33:59 +02:00
MaxBUhe dae5f66f81 add usercentrics chosable settings-value; add additional methods; add new multilang-idents 2023-05-31 10:33:43 +02:00
MaxBUhe 32e08a88ca rm typo in readme 2023-05-31 10:29:49 +02:00
MaxBUhe 9d9daf9a85 bump version && changelog to 1.7.0 2023-05-31 10:28:19 +02:00
MaxBUhe 6eefc062ba add missing article-getter 2023-05-31 10:17:51 +02:00
MaxBUhe 3f89e26bde adjust readme and switch used block-extension 2023-05-30 16:41:59 +02:00
MaxBUhe e624cfdfcb bump version && changelog to 1.6.0 2023-05-30 08:56:19 +02:00
MaxBUhe e2cdda530b adjusted usercentrics script 2023-05-26 13:49:50 +02:00
MaxBUhe 3e65d05c0b added position to block-extension 2023-05-24 11:09:36 +02:00
MaxBUhe 561a2101f1 [working-state] restructuring usercentricts & consentmanager decision
consentmanager decision is working so far; next step is implementing usercentricts
2023-05-23 14:52:07 +02:00
MaxBUhe 6fca52cc06 add usercentrics chosable settings-value; add additional methods; add new multilang-idents 2023-05-23 14:33:35 +02:00
MaxBUhe 347e551194 merge rel_1.x changelog 2023-05-23 11:49:09 +02:00
MaxBUhe dfdc5d5edf bump version && changelog to 1.5.0 2023-05-23 11:44:07 +02:00
MaxBUhe 000c49c56b bump version && changelog to 2.5.0 2023-05-23 11:32:20 +02:00
MaxBUhe ae6f9bfaa9 switch php-file-header hint 2023-05-23 10:49:59 +02:00
MaxBUhe 1d9e09b8b1 switch view_item and item_list template 2023-05-23 10:49:05 +02:00
MaxBUhe 002cc69d2a switch metadata entries; fix getPrice-bug 2023-05-23 10:06:21 +02:00
MaxBUhe f9a0834d26 add settings-entry; add consentmanager-option 2023-05-16 14:42:12 +02:00
MaxBUhe bb70cda626 fix unnecessary convert of int to str 2023-05-16 14:41:47 +02:00
MaxBUhe c9a1174c98 genuine code cleanup; switch hard-getter to methods and use price-object
# Conflicts:
#	Application/views/blocks/view_item.tpl
#	Application/views/ga4/add_to_cart.tpl
2023-05-16 14:41:32 +02:00
Christoph Staeblein f3b2911679 OXID UserCentrics support, general overhaul for cookie managers 2023-05-16 14:24:50 +02:00
MaxBUhe af78809ae5 add settings-entry; add consentmanager-option 2023-05-15 15:06:25 +02:00
MaxBUhe d531ba648b fix unnecessary convert of int to str 2023-05-12 14:08:52 +02:00
MaxBUhe a0c650fca3 Merge branch 'rel_2.x' 2023-05-11 15:26:45 +02:00
MaxBUhe af341a984b Merge branch 'rel_1.x'
# Conflicts:
#	CHANGELOG.md
#	metadata.php
2023-05-11 15:26:31 +02:00
MaxBUhe 122dd4cf53 genuine code cleanup; switch hard-getter to methods and use price-object 2023-05-10 15:01:56 +02:00
MaxBUhe 6d155d310b bump version && changelog to 1.4.0 2023-05-02 14:21:43 +02:00
Christoph Staeblein 6e62f39b71 OXID UserCentrics support, general overhaul for cookie managers
taken from pull-request; thank you C. Stäblein
2023-04-04 10:15:15 +02:00
MaxBUhe 616f31ecba Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-03-20 15:46:58 +01:00
MaxBuhe01 718b60e12c Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-03-17 15:31:34 +01:00
MaxBUhe 9cb3a54824 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-02-22 14:35:22 +01:00
MaxBuhe01 1c0d55bdc3 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-02-21 12:47:38 +01:00
MaxBuhe01 7c1f99e678 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-02-21 12:47:02 +01:00
MaxBUhe 126e746651 missing changelog-entry 2023-02-21 12:46:34 +01:00
54 changed files with 1604 additions and 340 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

View File

@ -0,0 +1,53 @@
<?php
namespace D3\GoogleAnalytics4\Application\Model;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\ViewConfig;
class ManagerHandler
{
/**
* @return string
*/
public function getCurrManager() :string
{
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
/** @var ViewConfig $oViewConfig */
$oViewConfig = oxNew(ViewConfig::class);
$aManagerList = $oManagerTypes->getManagerList();
foreach ($aManagerList as $managerName){
if ($oViewConfig->isModuleActive($managerName)){
return $managerName;
}
}
return $this->getExplicitManager();
}
/**
* @return string
*/
public function getModuleSettingExplicitManagerSelectValue() :string
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
}
/**
* @return string
*/
public function getExplicitManager() :string
{
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
return $oManagerTypes->isManagerInList($sPotentialManagerName)
? $sPotentialManagerName
: "NONE";
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace D3\GoogleAnalytics4\Application\Model;
class ManagerTypes
{
#ToDo: make own classes for each of the manager
const EXTERNAL_SERVICE = "externalService";
const NET_COOKIE_MANAGER = "net_cookie_manager";
/**
* Further information's:
* https://github.com/aggrosoft/oxid-cookie-compliance
*/
const AGCOOKIECOMPLIANCE = "agcookiecompliance";
/**
* Used the OXID Module.
*
* Further information's:
* https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html
*
* Usercentrics homepage:
* https://usercentrics.com
*/
const USERCENTRICS_MODULE = "oxps_usercentrics";
/**
* manually included usercentrics script
*/
const USERCENTRICS_MANUALLY = "USERCENTRICS";
const CONSENTMANAGER = "CONSENTMANAGER";
const COOKIEFIRST = "COOKIEFIRST";
const COOKIEBOT = "COOKIEBOT";
/**
* @return array
*/
public function getManagerList(): array
{
return [
"externalService" => self::EXTERNAL_SERVICE,
"agcookiecompliance" => self::AGCOOKIECOMPLIANCE,
"net_cookie_manager" => self::NET_COOKIE_MANAGER,
"oxps_usercentrics" => self::USERCENTRICS_MODULE,
"usercentrics" => self::USERCENTRICS_MANUALLY,
"consentmanager" => self::CONSENTMANAGER,
"cookiefirst" => self::COOKIEFIRST,
"cookiebot" => self::COOKIEBOT,
];
}
/**
* @param string $sManager
* @return bool
*/
public function isManagerInList(string $sManager) :bool
{
return in_array($sManager, $this->getManagerList(), true);
}
}

View File

@ -31,5 +31,23 @@ $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_cookieName' => 'CookieID',
'HELP_SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages<br><br>
<a href="https://consentmanager.net/">Consentmanager</a><br>
<a href="https://usercentrics.com/">Usercentrics</a><br>
<a href="https://cookiefirst.com">Cookiefirst</a><br>
<hr>
Bei weiteren Fragen stehen wir gern zur VerfĂĽgung! Kontaktieren Sie uns einfach unter <a href="https://www.d3data.de/">https://www.d3data.de/</a>',
'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_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 <a target="_blank" href="https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs">"<strong>Steuerungsparameter</strong>"</a><hr>
<strong>Beachte:</strong><br>
Sofern Sie die <a target="_blank" href="https://consentmanager.net" style="color: blue">consentmanager</a> CMP verwenden,
bitte ich Sie, grĂĽndlichst, die Hinweise der <a target="_blank" href="https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs/CMP/consentmanager.md">Moduldokumentation/Consentmanager</a> zu lesen.
'
];

View File

@ -4,28 +4,22 @@
</script>
[{if $oViewConf->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager -->
<script [{$oViewConf->getGtmScriptAttributes()}]>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
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;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
</script>
<!-- End Google Tag Manager -->
[{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}]
<!-- Google Tag Manager -->
<script [{$oViewConf->getGtmScriptAttributes()}]>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
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;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
</script>
<!-- End Google Tag Manager -->
[{/strip}]
[{/if}]
[{/if}]
[{$smarty.block.parent}]

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,33 +0,0 @@
[{$smarty.block.parent}]
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{strip}][{capture assign=d3_ga4_view_cart}]
let iPrice = "[{oxprice price=$oxcmp_basket->getPrice()}]";
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_cart',
'eventLabel':'Checkout Step 1',
'ecommerce': {
'actionField': "step: 1",
'currency': "[{$currency->name}]",
'value': iPrice.replace("€", ""),
'items': [
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var='_price' value=$basketitem->getUnitPrice()}]
{
'item_id': '[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]',
'item_name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]',
'price': [{$_price->getPrice()}],
'quantity':[{$basketitem->getAmount()}],
'position':[{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
[{/foreach}]
]
}
});
[{/capture}][{/strip}]
[{oxscript add=$d3_ga4_view_cart}]

View File

@ -1,35 +0,0 @@
[{$smarty.block.parent}]
[{strip}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{assign var="_gtmOrder" value=$oView->getOrder()}]
[{assign var="_gtmArticles" value=$_gtmOrder->getOrderArticles()}]
dataLayer.push({
'event': 'purchase',
'eventLabel':'Checkout Step 5',
'ecommerce': {
'transaction_id': '[{$_gtmOrder->oxorder__oxordernr->value}]',
'affiliation': '[{$oxcmp_shop->oxshops__oxname->value}]',
'value': '[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
'tax': '[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
'shipping': '[{$_gtmOrder->oxorder__oxdelcost->value}]',
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
'items':
[
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
{
'id': '[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]',
'variant': '[{$_gtmArticle->oxorderarticles__oxselvariant->value}]',
'price': [{$_gtmArticle->oxorderarticles__oxprice->value}],
'quantity': [{$_gtmArticle->oxorderarticles__oxamount->value}],
'position': [{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
[{/foreach}]
]
}
})
</script>
[{/strip}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/purchase.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/remove_from_cart.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_cart.tpl"}]

View File

@ -1,25 +1,3 @@
[{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_item',
'eventLabel':'Product View',
'ecommerce': {
'currency': '[{$currency->name}]',
'items': [
{
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}]
}
]
}
});
</script>
[{include file="event/view_item.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_item_list.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_search_result.tpl"}]

View File

@ -0,0 +1,61 @@
[{if $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}]
[{assign var="oGtmProduct" value=$d3CmpBasket->d3GtmRequestedArticleLoadedByAnid()}]
[{assign var="oGtmAmountArticlesAdded" value=$d3CmpBasket->getD3GtmAddToCartAmountArticles()}]
[{*$smarty.block.parent*}]
[{* variable $oGtmProduct is passed from parent tempalte *}]
[{assign var="d3PriceObject" value=$oGtmProduct->getPrice()}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{assign var="gtmManufacturer" value=$oGtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$oGtmProduct->getCategory()}]
[{block name="d3_ga4_add_to_cart_list_block"}]
[{capture name="d3_ga4_add_to_cart_listtpl"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{*** Debug cases ***}]
[{*event.preventDefault();*}]
let iArtQuantity = $("[{$htmlIdAmountOfArticles}]").val();
let iArtQuantityAdded = [{$oGtmAmountArticlesAdded}];
if(!iArtQuantity && (iArtQuantityAdded === 1)){
iArtQuantity = 1;
}else{
iArtQuantity = iArtQuantityAdded;
}
dataLayer.push({
'isAddToBasket': true,
'event':'add_to_cart',
'eventLabel': 'add_to_cart',
'ecommerce': {
'currency': "[{$currency->name}]",
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
'items': [
{
'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$oGtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
[{/if}]
'quantity': iArtQuantity
}
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_add_to_cart_listtpl}]
[{/block}]
[{/if}]

View File

@ -0,0 +1,56 @@
[{block name="d3_ga4_purchase_block"}]
[{capture name="d3_ga4_purchase"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{assign var="gtmOrder" value=$oView->getOrder()}]
[{assign var="gtmBasket" value=$oView->getBasket()}]
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
dataLayer.push({
'event': 'purchase',
'eventLabel':'Checkout Step 5',
'ecommerce':
{
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
'value': [{$gtmOrder->getTotalOrderSum()}],
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
'items':
[
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
{
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
[{if $gtmPurchaseItemCategory}]
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0, true)}]',
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1, true)}]',
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2, true)}]',
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
[{/if}]
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
'position': [{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
})
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_purchase}]
[{/block}]

View File

@ -0,0 +1,46 @@
[{block name="d3_ga4_remove_from_cart_block"}]
[{if $hasBeenReloaded}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{capture name="d3_ga4_remove_from_cart"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'isRemoveFromCart': true,
'event': 'remove_from_cart',
'eventLabel':'remove_from_cart',
'ecommerce': {
'actionField': "step: 1",
'currency': "[{$currency->name}]",
'value': [{$d3BasketPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'items': [
[{foreach from=$toRemoveArticles->getArray() name=gtmRemovedItems item=rmItem key=rmItemindex}]
[{assign var="d3oItemPrice" value=$rmItem->getPrice()}]
[{assign var="gtmBasketItemCategory" value=$rmItem->getCategory()}]
{
'item_id': '[{$rmItem->getFieldData('oxartnum')}]',
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
'item_variant': '[{$rmItem->getFieldData('oxvarselect')}]',
[{if $gtmBasketItemCategory}]
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}]
'price': [{$d3oItemPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
'position': [{$smarty.foreach.gtmRemovedItems.index}]
}[{if !$smarty.foreach.gtmRemovedItems.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_remove_from_cart}]
[{/if}]
[{/block}]

View File

@ -0,0 +1,50 @@
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{block name="d3_ga4_view_cart_block"}]
[{capture name="d3_ga4_view_cart"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_cart',
'eventLabel':'Checkout Step 1',
'ecommerce':
{
'actionField': "step: 1",
'currency': "[{$currency->name}]",
'value': [{$d3BasketPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'items':
[
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
[{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')}]',
[{if $gtmBasketItemCategory}]
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}]
'price': [{$d3oItemPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_view_cart}]
[{/block}]

View File

@ -0,0 +1,41 @@
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{block name="d3_ga4_view_item_block"}]
[{capture name="d3_ga4_view_item"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_item',
'eventLabel':'Product View',
'ecommerce':
{
'currency': '[{$currency->name}]',
'items':
[
{
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
[{/if}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
'price': [{$d3PriceObject->getPrice()}]
}
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_view_item}]
[{/block}]

View File

@ -0,0 +1,45 @@
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
[{assign var="breadCrumb" value=''}]
[{block name="d3_ga4_view_item_list_block"}]
[{if $gtmProducts|@count}]
[{capture name="d3_ga4_view_item_list"}]
[{strip}]
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'view_item_list',
'event_name': 'view_item_list',
'ecommerce': {
'item_list_id': '[{$oView->getCategoryId()}]',
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
[{/if}]
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_view_item_list}]
[{/if}]
[{/block}]

View File

@ -0,0 +1,44 @@
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{block name="d3_ga4_view_search_result_block"}]
[{if $gtmProducts}]
[{capture name="d3_ga4_view_search_result"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_search_result',
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
'ecommerce': {
'search_term': '[{$searchparamforhtml}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
[{/if}]
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
[{/if}]
[{/block}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -1,60 +0,0 @@
[{$smarty.block.parent}]
[{*$gtmProduct|get_class_methods|dumpvar*}]
[{capture assign=d3_ga4_add_to_cart}]
[{block name="d3_ga4_add_to_basket"}]
$("#toBasket").click(function(event) {
[{*** Debug cases ***}]
[{*event.preventDefault();*}]
let iArtQuantity = $("#amountToBasket").val();
dataLayer.push({
'isAddToBasket': true,
'event':'add_to_cart',
'eventLabel': 'add_to_cart',
'ecommerce': {
'currency': "[{$currency->name}]",
'value': iArtQuantity*[{$gtmProduct->getFieldData('oxprice')}],
'items': [
{
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'price': '[{$gtmProduct->getFieldData('oxprice')}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
'item_category': itemCategories[0] || 'no category',
'item_category_2':itemCategories[1] || '',
'item_category_3':itemCategories[2] || '',
'item_category_4':itemCategories[3] || '',
[{if false}]
'item_list_name': 'Search Results', // If associated with a list selection.
'item_list_id': 'SR123', // If associated with a list selection.
'index': 1, // If associated with a list selection.
[{/if}]
'quantity': iArtQuantity
}
]
}
});
});
[{/block}]
[{/capture}]
[{oxscript add=$d3_ga4_add_to_cart}]
[{strip}]
[{* variable $gtmProduct is passed from parent tempalte *}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
let itemCategories = '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]'.split('/');
</script>
[{/strip}]

View File

@ -1,32 +0,0 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{if $gtmProducts|@count}]
[{strip}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_search_result',
'eventLabel':'view_search_result',
'ecommerce': {
'search_term': '[{$searchparamforhtml}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}
});
</script>
[{/strip}]
[{/if}]

View File

@ -1,34 +0,0 @@
[{assign var="gtmProducts" value=$products}]
[{assign var="breadCrumb" value=''}]
[{if $gtmProducts|@count}]
[{strip}]
<script>
/* ga4 */
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'view_item_list',
'event_name': 'view_item_list',
'ecommerce': {
'item_list_id': '[{$oView->getCategoryId()}]',
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}
});
</script>
[{/strip}]
[{/if}]

View File

@ -0,0 +1,18 @@
[{capture append="oxidBlock_content"}]
[{assign var="template_title" value="MY_WISH_LIST"|oxmultilangassign}]
<h1 class="page-header">[{oxmultilang ident="MY_WISH_LIST"}]</h1>
[{if $oView->getNoticeProductList()}]
[{include file="widget/product/list.tpl" type="line" listId="noticelistProductList" title="" products=$oView->getNoticeProductList() removeFunction="tonoticelist" owishid=$oxcmp_user->oxuser__oxid->value}]
[{else}]
<p class="alert alert-info">[{oxmultilang ident="WISH_LIST_EMPTY"}]</p>
[{/if}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}]
[{/capture}]
[{capture append="oxidBlock_sidebar"}]
[{include file="page/account/inc/account_menu.tpl" active_link="noticelist"}]
[{/capture}]
[{include file="layout/page.tpl" sidebar="Left"}]

View File

@ -0,0 +1,32 @@
[{capture append="oxidBlock_content"}]
[{assign var="template_title" value="LISTMANIA"|oxmultilangassign}]
[{assign var="_actvrecommlist" value=$oView->getActiveRecommList()}]
<h1 class="page-header">[{oxmultilang ident="LISTMANIA"}]</h1>
[{if $oView->isSavedList()}]
[{assign var="_statusMessage" value="LISTMANIA_LIST_SAVED"|oxmultilangassign}]
[{include file="message/success.tpl" statusMessage=$_statusMessage}]
[{/if}]
[{block name="account_redommendationlist_content"}]
[{include file="form/recommendation_edit.tpl" actvrecommlist=$_actvrecommlist}]
<hr>
[{if !$oView->getActiveRecommList()}]
[{assign var="blEdit" value=true}]
[{include file="page/recommendations/inc/list.tpl"}]
[{/if}]
[{/block}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}]
[{/capture}]
[{capture append="oxidBlock_sidebar"}]
[{include file="page/account/inc/account_menu.tpl" active_link="recommendationlist"}]
[{/capture}]
[{include file="layout/page.tpl" sidebar="Left"}]

View File

@ -0,0 +1,44 @@
[{capture append="oxidBlock_content"}]
[{assign var="template_title" value="MY_GIFT_REGISTRY"|oxmultilangassign}]
[{if !$oView->getWishListUsers() && $oView->getWishListSearchParam()}]
[{assign var="_statusMessage" value="MESSAGE_SORRY_NO_GIFT_REGISTRY"|oxmultilangassign}]
[{include file="message/error.tpl" statusMessage=$_statusMessage}]
[{/if}]
[{assign var="editval" value=$oView->getEnteredData()}]
[{if $oView->isWishListEmailSent()}]
[{assign var="_statusMessage" value="GIFT_REGISTRY_SENT_SUCCESSFULLY"|oxmultilangassign:$editval->rec_email}]
[{include file="message/notice.tpl" statusMessage=$_statusMessage}]
[{/if}]
<h1 class="page-header">[{$oView->getTitle()}]</h1>
<div class="wishlist-search">
[{include file="form/wishlist_search.tpl" searchClass="account_wishlist"}]
</div>
<hr>
<div class="wishlist">
[{if $oView->getWishList()}]
[{include file="form/wishlist_publish.tpl"}]
<hr>
[{include file="form/wishlist_suggest.tpl"}]
[{/if}]
</div>
[{if $oView->getWishList()}]
[{include file="widget/product/list.tpl" type="line" listId="wishlistProductList" title="" products=$oView->getWishProductList() removeFunction="towishlist" toBasketFunction="tobasket" owishid=$oxcmp_user->oxuser__oxid->value}]
[{else}]
<p class="alert alert-info">
[{oxmultilang ident="GIFT_REGISTRY_EMPTY"}]
</p>
[{/if}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}]
[{/capture}]
[{capture append="oxidBlock_sidebar"}]
[{include file="page/account/inc/account_menu.tpl" active_link="wishlist"}]
[{/capture}]
[{include file="layout/page.tpl" sidebar="Left"}]

View File

@ -4,6 +4,103 @@ 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.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
## [2.14.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.13.1...2.14.0) - 2023-01-22
### Added
- add_to_cart Event to several new shop-pages (landing-page, Account, category article-list, start)
- PHPStan code-cleanup
### Changed
- template structure
- code cleanup
## [2.13.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.13.0...2.13.1) - 2023-01-03
### Fixed
- error on array-count at zero entries
## [2.13.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.12.0...2.13.0) - 2023-09-13
### Added
- extended Docs
### Changed
- control-param name
- control-param function
- adjusted check for set control-param
- consentmanager-script-adjustments
## [2.12.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.11.1...2.12.0) - 2023-09-07
### Added
- cookiebot functionality
## [2.11.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.10.1...2.11.0) - 2023-08-23
### Added
- manufacturer extension
- working debug_mode
### Changed
- check for 'article has been removed'
- general template cleanup
## [2.10.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.10.0...2.10.1) - 2023-08-03
### Added
- missing param to identify the event
## [2.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.2...2.10.0) - 2023-08-02
### Added
- new Event "remove_from_cart"
## [2.9.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.1...2.9.2) - 2023-06-29
### Fixed
- wrong variable for category-object check
## [2.9.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.0...2.9.1) - 2023-06-27
### Fixed
- deny method call on no category
## [2.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.8.0...2.9.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
- 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
## [2.6.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.5.0...2.6.0) - 2023-05-31
### Added
- add settings to explicit choose an external service (usercentrics/ consentmanager)
- position to block-extension
- extended instructions to check for in readme
### Fixed
- usercentrics script
- missing right articleList-getter
### Changed
- view_item_list-template block extension
- cookieManager handling
### Removed
- additional check for cookieManagerType
## [2.5.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.4.0...2.5.0) - 2023-05-23
### Added
- additional settings to explicitly indicate that consentmanager is used
### Fixed
- unnecessary converting of int to str
- missing PriceObject-bug
### Changed
- genuine code cleanup
## [2.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.3...2.4.0) - 2023-05-02
### Added
- "OXID Cookie Management powered by usercentrics" compatibility
@ -45,6 +142,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- using of ContainerFactory in ViewConfig
## [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
## [1.14.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.13.0...1.14.0) - 2024-01-03
### Added
- add_to_cart Event to several new shop-pages (landing-page, Account, category article-list, start)
- PHPStan code-cleanup
### Changed
- template structure
- code cleanup
## [1.13.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.12.0...1.13.0) - 2023-09-13
### Added
- extended Docs
### Changed
- control-param name
- control-param function
- adjusted check for set control-param
- consentmanager-script-adjustments
## [1.12.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.1...1.12.0) - 2023-09-07
### Added
- cookiebot functionality
## [1.11.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.0...1.11.1) - 2023-08-17
### Fixed
- metadata class entry
## [1.11.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.10.0...1.11.0) - 2023-08-16
### Added
- remove_from_cart
- auto debug_mode setter
- manufacturer extension for breadcrumb
### Changed
- general template cleanup
## [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
## [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
- additional settings to explicitly indicate that consentmanager is used
### Fixed
- unnecessary converting of int to str
- missing PriceObject-bug
### Changed
- genuine code cleanup
## [1.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.3.1...1.4.0) - 2023-05-02
### Added
- "OXID Cookie Management powered by usercentrics" compatibility
- usercentrics defined script attributes
- cookie-manager evaluation
### Changed
- genuine clean up of base-js-files
## [1.3.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2.1...1.3.1) - 2023-03-17
### Added
- Aggrosoft-Cookie-Consent compatibility
@ -53,7 +241,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
### Fixed
- price formatting view_cart
- price formatting in view_cart
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
### Added
@ -67,7 +255,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- switched price formatting
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/releases/tag/1.0) - 2023-01-20
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.0) - 2023-01-20
### Added
- publication of app features

View File

@ -0,0 +1,18 @@
# Consentmanager
## 1. Steuerungsparameter
Tragen Sie hier die gewĂĽnschte ID des zu prĂĽfenden Anbieters (Vendor-ID) ein.<br>
Diese ID finden Sie in Ihrem Consentmanager-Dashboard, links, unter "CMP > Anbieter".
Nähere Informationen hierzu suchen Sie bitte auf der offiziellen Webseite von [app.consentmanager](https://help.consentmanager.de/books/cmp/page/4-configuring-vendors-and-cookies).
## 2. Gebräuchliche ID's
- s26 (Google Analytics/ GA/ GA4)
- s905 (Google Tag Manager/ GTM)
## 3. Einrichtung GTM
Die von Ihnen eingetragene ID muss oder ist schlussendlich die ID, auf die im GTM-Umfeld geprĂĽft wird.
Das heiĂźt, dass sich die Eintragung nach GTM, oder umgekehrt, richtet.
### Unterstützung benötigt?
Kein Problem!
Kontaktieren Sie uns gern unter [d3data.de](https://www.d3data.de)

View File

@ -1,36 +1,16 @@
# Technische Doku
## GA4 Events / Customizing
FĂĽr alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/ga4/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
FĂĽr alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/event/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
Die Einbindung dieser Event-Templates erfolgt über TPL-Blöcke unter `source/modules/d3/googleanalytics4/Application/views/blocks/`.
*Hinweis: nicht alle templates sind bereits gefĂĽllt. WĂĽnschen Sie die Implementierung eines unausgefĂĽllten templates?
Kommen Sie auf uns zu unter https://www.d3data.de/
## Blöcke
Für den geregelten Ablauf sind folgende Blöcke nötig:
- Suchergebnisse
- Blockname: search_results
- 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
- GA4 Event: view_item_list
- Detailseite
- Blockname: details_productmain_title
- Datei: page/details/inc/productmain.tpl
- GA4 Event: view_item
- dem WK hinzufĂĽgen (button)
- Blockname: details_productmain_tobasket
- Datei: page/details/inc/productmain.tpl
- GA4 Event: add_to_cart
- Warenkorb
- Blockname: checkout_basket_main
- Datei: page/checkout/basket.tpl
- GA4 Event: view_cart
- abgeschlossener Kauf
- Blockname: checkout_thankyou_main
- Datei: page/checkout/thankyou.tpl
- GA4 Event: purchase
## Steuerungsparameter
Tragen Sie hier im Normalfall die ID des zu prĂĽfenden Cookies ein.
In bestimmten Fällen, müssen Sie hier alternative Werte eintragen. Diese Fälle sind bedingt
nach der gewählten CMP (Consent Manager Platform).
> nähere Infos unter [CMP](#consent-manager-platform-cmp)
## VerfĂĽgbare Datalayer Variablen
FĂĽr die einfachste Ăśbersicht der enthaltenen Daten empfehle ich den Vorschau-Modus vom Google Tag Manager.
@ -50,6 +30,9 @@ Dann tragen Sie in den Folgeeinstellungen unter "Cookie Manager Einstellungen",
die Cookie-ID des zugehörigen Cookies ein.
Aktivieren Sie anschlieĂźend diese Weiche. Setzen Sie den Haken bei "Eigenen Cookie Manager nutzen?".
## Consent Manager Platform (CMP)
- [Consentmanager](https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs/CMP/consentmanager.md)
### UnterstĂĽtzung fĂĽr
- [aggrosoft - oxid-cookie-compliance](https://github.com/aggrosoft/oxid-cookie-compliance)
- https://github.com/aggrosoft/oxid-cookie-compliance
@ -63,6 +46,20 @@ 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
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
- 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
Google Tag Manager eintragen
- [Consent Management Provider](https://www.consentmanager.net/)
- In der Consentmanager-Oberfläche den Anbieter "Google Tag Manager" mit der ID s905 hinzufügen
- Im Frontend, im consentmanager-Pop-up nach dem 'Google Tag Manager' suchen
- kleines Fragezeichen neben den Namen anklicken und ganz runter scrollen
- prĂĽfen, ob ein Cookie vorgegeben ist
- sonst, in der Consentmanager-Oberfläche Cookie-Liste entsprechendes Cookie suchen und im Admin unter
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
- [Cookiefirst](https://cookiefirst.com)
- im Cookiefirst-Hub das jeweilige Cookie finden underen zugeordnete Kategorie kopieren
- die kopierte Kategory wird nun in den Einstellungen des Moduls hinterlegt:
```Erweiterungen > Module > Google Analytics 4 > Einstell. > Cookie Manager Einstellungen > Steuerungsparameter (vormals CookieID)```
- **Wichtig!** bei Nutzung des Consent-Managers von Google, muss zwangsläufig die Einstellung "Cookie manager Nutzen?" __ausgeschalten!__ werden

View File

@ -15,4 +15,54 @@
namespace D3\GoogleAnalytics4\Modules\Core{
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
}
namespace D3\GoogleAnalytics4\Modules\Application\Model{
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Controller{
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController;
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController;
use OxidEsales\Eshop\Application\Controller\AccountWishlistController;
use OxidEsales\Eshop\Application\Controller\Admin\ManufacturerController;
use OxidEsales\Eshop\Application\Controller\ArticleListController;
use OxidEsales\Eshop\Application\Controller\SearchController;
use OxidEsales\Eshop\Application\Controller\StartController;
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
class ThankYouController_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {}
class ArticleListController_AddToCartHelpMethods_parent extends ArticleListController {}
class ArticleDetailsController_parent extends \OxidEsales\Eshop\Application\Controller\ArticleDetailsController {}
class d3GtmAccountNoticeListController_parent extends AccountNoticeListController {}
class d3GtmAccountRecommlistController_parent extends AccountRecommlistController {}
class d3GtmAccountWishlistController_parent extends AccountWishlistController {}
class d3GtmStartController_parent extends StartController {}
class d3GtmSearchController_parent extends SearchController {}
class d3GtmManufacturerListController_parent extends ManufacturerController {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Component{
use OxidEsales\Eshop\Application\Component\BasketComponent;
class d3GtmBasketComponentExtension_parent extends BasketComponent {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget{
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails;
class d3GtmWidgetArticleDetails_parent extends ArticleDetails {}
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget;
class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent
{
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Component;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Core\Registry;
class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
{
/**
* @param $sProductId
* @param $dAmount
* @param $aSel
* @param $aPersParam
* @param $blOverride
* @return mixed|string
* @throws \Exception
*/
public function toBasket($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride = false)
{
$return = parent::toBasket($sProductId, $dAmount, $aSel, $aPersParam, $blOverride);
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', true);
$iAmountArticlesAddedToCart = (int) Registry::getRequest()->getRequestEscapedParameter('am');
if ($iAmountArticlesAddedToCart){
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', $iAmountArticlesAddedToCart);
}else{
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', 1);
}
return $return;
}
/**
* @return int
*/
public function getD3GtmAddToCartAmountArticles() :int
{
$iAmount = Registry::getSession()->getVariable('d3GtmAddToCartAmountArticles');
Registry::getSession()->deleteVariable('d3GtmAddToCartAmountArticles');
return (int) $iAmount;
}
/**
* @return bool
*/
public function getAddToBasketDecision() :bool
{
$decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger');
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', false);
return (bool) $decision;
}
/**
* @return Article|null
*/
public function d3GtmRequestedArticleLoadedByAnid()
{
$sAnid = Registry::getRequest()->getRequestEscapedParameter('anid');
$oArticle = null;
if ($sAnid){
/** @var Article $oArticle */
$oArticle = oxNew(Article::class);
$oArticle->load($sAnid);
}
return $oArticle;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class ArticleDetailsController extends ArticleDetailsController_parent
{
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class ArticleListController_AddToCartHelpMethods extends ArticleListController_AddToCartHelpMethods_parent
{
public function render()
{
$render = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $render;
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use OxidEsales\Eshop\Application\Component\BasketComponent;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\ArticleList;
use OxidEsales\Eshop\Core\Registry;
use oxSystemComponentException;
class BasketController extends BasketController_parent
{
/**
* @return string
*/
public function render()
{
$return = parent::render();
$this->d3GA4getRemovedArticlesListObject();
return $return;
}
/**
* @return void
* @throws oxSystemComponentException
*/
public function d3GA4getRemovedArticlesListObject() :void
{
$this->addTplParam('hasBeenReloaded', false);
// collecting items to add
$aProducts = Registry::getRequest()->getRequestEscapedParameter('aproducts');
// collecting specified item
$sProductId = Registry::getRequest()->getRequestEscapedParameter('aid');
if ($sProductId) {
// additionally fetching current product info
$dAmount = Registry::getRequest()->getRequestEscapedParameter('am');
// select lists
$aSel = Registry::getRequest()->getRequestEscapedParameter('sel');
/** @var BasketComponent $oBasketComponent */
$oBasketComponent = $this->getComponent('oxcmp_basket');
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
$sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex');
$aProducts[$sProductId] = [
'am' => $dAmount,
'sel' => $aSel,
'persparam' => $aPersParam,
'basketitemid' => $sBasketItemId
];
}
if (is_array($aProducts) && count($aProducts)) {
$toRemoveArticleIdList = [];
$artIdOnArtAmountList = [];
if ($this->isArticleRemovedState($aProducts)) {
//setting amount to 0 if removing article from basket
foreach ($aProducts as $sProductId => $aProduct) {
if ((isset($aProduct['remove']) && $aProduct['remove']) or intval($aProduct['am']) === 0) {
if (!in_array($aProduct, $toRemoveArticleIdList)) {
$toRemoveArticleIdList[] = $aProduct['aid'];
$artIdOnArtAmountList[$aProduct['aid']] = $aProduct['am'];
}
$aProducts[$sProductId]['am'] = 0;
#for GA4 Event
$this->addTplParam('hasBeenReloaded', true);
} else {
unset($aProducts[$sProductId]);
}
}
}
$oArtList = oxNew(ArticleList::class);
$oArtList->loadIds($toRemoveArticleIdList);
#dumpVar($this->getBasketArticles());
/** @var Article $item */
foreach ($oArtList->getArray() as $item){
foreach ($artIdOnArtAmountList as $artId => $artAmount){
if ($item->getId() === $artId){
$item->assign(['d3AmountThatGotRemoved' => $artAmount]);
}
}
}
$this->addTplParam('toRemoveArticles', $oArtList);
}
}
/**
* @return bool
*
* checks, if we're in the short state of "an Article has been removed"
* We check by looking for the "'removeBtn' is not null", as a sign for it has been triggered/ clicked
* if that doesn't work, we check if there's an Article in the Products array, that has "'am' = 0"
* Which also shows we're in that state rn
*/
protected function isArticleRemovedState(array $productsArray) :bool
{
if (Registry::getRequest()->getRequestEscapedParameter('removeBtn')
or Registry::getRequest()->getRequestEscapedParameter('updateBtn')
){
return true;
}else{
foreach ($productsArray as $aProduct) {
if (intval($aProduct['am']) === 0) {
return true;
}
}
}
return false;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use OxidEsales\Eshop\Application\Model\Country;
use OxidEsales\Eshop\Application\Model\Order;
class ThankYouController extends ThankYouController_parent
{
/**
* @return Country
*/
public function d3GAGetUserCountry()
{
/** @var Order $oOrder */
$oOrder = $this->getOrder();
$sCountryId = $oOrder->getFieldData('oxbillcountryid');
/** @var Country $oCountry */
$oCountry = oxNew(Country::class);
$oCountry->load($sCountryId);
return $oCountry;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_parent
{
protected $_sThisTemplate = 'page/account/d3gtmnoticelist.tpl';
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_parent
{
protected $_sThisTemplate = 'page/account/d3gtmrecommendationlist.tpl';
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_parent
{
protected $_sThisTemplate = 'page/account/d3gtmwishlist.tpl';
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmManufacturerListController extends d3GtmManufacturerListController_parent
{
public function render()
{
$return = parent::render();
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return $return;
}
}

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmSearchController extends d3GtmSearchController_parent
{
/**
* @return string
*/
public function render()
{
$return = parent::render();
if (false === in_array('oxcmp_basket', $this->getComponents())){
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
}
return $return;
}
}

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmStartController extends d3GtmStartController_parent
{
public function render()
{
$return = parent::render();
if (false === in_array('oxcmp_basket', $this->getComponents())){
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
}
return $return;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Model;
use OxidEsales\Eshop\Application\Model\Payment;
class Basket extends Basket_parent
{
/**
* @return string
*/
public function getPaymentOnPaymentId() :string
{
if ($this->getPaymentId()){
$oPayment = oxNew(Payment::class);
if ($oPayment->load($this->getPaymentId())){
return $oPayment->getFieldData('oxdesc');
}
}
return "couldn't load payment!";
}
}

View File

@ -0,0 +1,44 @@
<?php
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
)
);
}
}

View File

@ -0,0 +1,44 @@
<?php
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
)
);
}
}

View File

@ -12,10 +12,16 @@
namespace D3\GoogleAnalytics4\Modules\Core;
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class ViewConfig extends ViewConfig_parent
{
@ -36,26 +42,24 @@ class ViewConfig extends ViewConfig_parent
return $this->sContainerId;
}
public function getCookieManagerType()
/**
* @return void
*/
public function defineCookieManagerType() :void
{
if ($this->sCookieManagerType === null)
{
$this->sCookieManagerType = false;
$allowedManagerTypes = [
'net_cookie_manager',
'agcookiecompliance',
'oxps_usercentrics'
];
foreach ($allowedManagerTypes as $type) {
if ($this->isModuleActive($type)) {
$this->sCookieManagerType = $type;
break;
}
}
/** @var ManagerHandler $oManagerHandler */
$oManagerHandler = oxNew(ManagerHandler::class);
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
}
return $this->sCookieManagerType;
}
/**
* @return bool
*/
public function shallUseOwnCookieManager() :bool
{
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
}
/**
@ -63,37 +67,47 @@ class ViewConfig extends ViewConfig_parent
*/
public function D3blShowGtmScript()
{
$oConfig = $this->getConfig();
/** @var Config $oConfig */
$oConfig = Registry::getConfig();
// No Cookie Manager in use
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
if (!$this->shallUseOwnCookieManager()) {
return true;
}
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
$this->defineCookieManagerType();
$sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_controlParameter'));
// Netensio Cookie Manager
if ($this->getCookieManagerType() == "net_cookie_manager") {
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
$oSession = Registry::getSession();
$aCookies = $oSession->getVariable("aCookieSel");
return (!is_null($aCookies) && is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
return (is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
}
// Aggrosoft Cookie Consent
if ($this->getCookieManagerType() == "agcookiecompliance") {
if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) {
if (method_exists($this, "isCookieCategoryEnabled")) {
return $this->isCookieCategoryEnabled($sCookieID);
}
}
// UserCentrics
if ($this->getCookieManagerType() == "oxps_usercentrics") {
// UserCentrics or consentmanager
if (
$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::COOKIEBOT
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
)
{
// Always needs the script-tags delivered to the DOM.
return true;
}
// Cookie Manager not (yet) supported
return false;
}
@ -102,15 +116,33 @@ class ViewConfig extends ViewConfig_parent
* This is especially important for UserCentrics.
* @return string
*/
public function getGtmScriptAttributes()
public function getGtmScriptAttributes() :string
{
if ($this->getCookieManagerType() == "oxps_usercentrics") {
$oConfig = $this->getConfig();
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
$sControlParameter = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_controlParameter'));
if ($sCookieId) {
return 'type="text/plain" data-usercentrics="' . $sCookieId . '"';
}
if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){
return "";
}
if (
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
)
{
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
}
if ($this->sCookieManagerType === ManagerTypes::CONSENTMANAGER)
{
return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"';
}
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"';
}
if ($this->sCookieManagerType === ManagerTypes::COOKIEBOT){
return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"';
}
return "";
@ -118,6 +150,10 @@ class ViewConfig extends ViewConfig_parent
private $blGA4enabled = null;
/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function isGA4enabled()
{
if ($this->blGA4enabled === null)
@ -137,7 +173,7 @@ class ViewConfig extends ViewConfig_parent
$oConfig = Registry::getConfig();
$oView = $oConfig->getTopActiveView();
/** @var FrontendController $oShop */
/** @var User|false|null $oUser */
$oUser = $oConfig->getUser();
$cl = $this->getTopActiveClassName();
@ -160,14 +196,19 @@ class ViewConfig extends ViewConfig_parent
'title' => $oView->getTitle(),
'cl' => $cl,
],
'userid' => ($oUser ? $oUser->getId() : false),
'sessionid' => session_id() ?? false,
'userid' => $oUser instanceof User ? $oUser->getId() : false,
'sessionid' => session_id(),
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
];
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
}
public function isDebugModeOn() :bool
{
return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug');
}
public function isPromotionList($listId)
{
$oConfig = Registry::getConfig();

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 Template-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

@ -46,7 +46,8 @@
"require": {
"php": ">=7.1",
"oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0"
"google/apiclient":" ^2.0",
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4": {

View File

@ -1,5 +1,36 @@
<?php
use D3\GoogleAnalytics4\Modules\Application\Component\d3GtmBasketComponentExtension;
use D3\GoogleAnalytics4\Modules\Application\Component\Widget\d3GtmWidgetArticleDetails as d3GtmWidgetArticleDetails;
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleDetailsController;
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleListController_AddToCartHelpMethods;
use D3\GoogleAnalytics4\Modules\Application\Controller\BasketController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountNoticeListController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountRecommlistController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountWishlistController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmManufacturerListController as d3GtmManufacturerListController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmSearchController;
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController;
use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController;
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
use D3\GoogleAnalytics4\Modules\Application\Model\Manufacturer as Manufacturer;
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent;
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails as OEArticleDetails;
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController as OEAccountNoticeListController;
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController as OEAccountRecommlistController;
use OxidEsales\Eshop\Application\Controller\AccountWishlistController as OEAccountWishlistController;
use OxidEsales\Eshop\Application\Controller\ArticleDetailsController as OEArticleDetailsController;
use OxidEsales\Eshop\Application\Controller\ArticleListController as OEArticleListController;
use OxidEsales\Eshop\Application\Controller\BasketController as OEBasketController;
use OxidEsales\Eshop\Application\Controller\ManufacturerListController as OEManufacturerListController;
use OxidEsales\Eshop\Application\Controller\SearchController as OESearchController;
use OxidEsales\Eshop\Application\Controller\StartController as OEStartController;
use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouController;
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
use OxidEsales\Eshop\Application\Model\Category as OECategory;
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
$sMetadataVersion = '2.1';
@ -17,25 +48,58 @@ $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.4.0',
'version' => '2.15.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
'extend' => [
OEViewConfig::class => ViewConfig::class
// Core
OEViewConfig::class => ViewConfig::class,
// Model
OECategory::class => Category::class,
OEBasket::class => Basket::class,
OEManufacturer::class => Manufacturer::class,
// Controller
OEBasketController::class => BasketController::class,
OEThankYouController::class => ThankYouController::class,
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
OEArticleDetailsController::class => ArticleDetailsController::class,
OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class,
OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class,
OEAccountWishlistController::class => d3GtmAccountWishlistController::class,
OEStartController::class => d3GtmStartController::class,
OESearchController::class => d3GtmSearchController::class,
OEManufacturerListController::class => d3GtmManufacturerListController::class,
// Component
OEArticleDetails::class => d3GtmWidgetArticleDetails::class,
OEBasketComponent::class => d3GtmBasketComponentExtension::class,
],
'templates' => [
// GA4 events
'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl',
'ga4_search.tpl' => 'd3/googleanalytics4/Application/views/ga4/search.tpl',
'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl',
// Event files that store the GA4 Event-Information
'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl',
'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl',
'event/view_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.tpl',
'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',
'event/view_item_list.tpl' => 'd3/googleanalytics4/Application/views/event/view_item_list.tpl',
'event/view_search_result.tpl' => 'd3/googleanalytics4/Application/views/event/view_search_result.tpl',
'event/remove_from_cart.tpl' => 'd3/googleanalytics4/Application/views/event/remove_from_cart.tpl',
// complete overwritten file of OXID-Originals
// the path of the template-name is the original path to the file in OXID-context from tpl/->
'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',
],
'blocks' => [
// tag manager js
[
'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
[
@ -43,18 +107,6 @@ $aModule = [
'block' => 'theme_svg_icons',
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
],
// checkout
// view_cart
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => '/Application/views/blocks/checkout_s1.tpl'
],
[
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_main',
'file' => '/Application/views/blocks/checkout_s5.tpl'
],
// details
[
'template' => 'page/details/inc/productmain.tpl',
@ -62,26 +114,56 @@ $aModule = [
'file' => '/Application/views/blocks/view_item.tpl',
'position' => 150
],
// checkout
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => '/Application/views/blocks/view_cart.tpl'
],
[
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_main',
'file' => '/Application/views/blocks/purchase.tpl'
],
// Lists
// view_item_list
[
'template' => 'widget/product/list.tpl',
'block' => 'd3Ga4_view_item_list',
'file' => '/Application/views/ga4/view_item_list.tpl',
'template' => 'page/list/list.tpl',
'block' => 'page_list_productlist',
'file' => '/Application/views/blocks/view_item_list.tpl',
'position' => 150
],
// view_search_result
[
'template' => 'page/search/search.tpl',
'block' => 'search_results',
'file' => '/Application/views/ga4/search.tpl',
'file' => '/Application/views/blocks/view_search_result.tpl',
'position' => 150
],
// add_to_cart
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_tobasket',
'file' => '/Application/views/ga4/add_to_cart.tpl',
'file' => '/Application/views/blocks/details_productmain_tobasket.tpl',
'position' => 150
],
[
'template' => 'page/list/list.tpl',
'block' => 'page_list_listbody',
'file' => '/Application/views/blocks/page_list_listbody.tpl',
'position' => 150
],
[
'template' => 'page/shop/start.tpl',
'block' => 'start_welcome_text',
'file' => '/Application/views/blocks/start_welcome_text.tpl',
'position' => 150
],
// remove_from_cart
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => '/Application/views/blocks/remove_from_cart.tpl',
'position' => 150
]
],
@ -116,10 +198,17 @@ $aModule = [
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_cookieName',
'name' => 'd3_gtm_settings_controlParameter',
'type' => 'str',
'value' => 'example',
'value' => '',
'position' => 999
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
'type' => 'select',
'value' => 'none',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT',
],
]
];

View File

@ -1,10 +1,15 @@
parameters:
scanFiles:
- IntelliSenseHelper.php
- ../../oxid-esales/oxideshop-ce/source/bootstrap.php
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
level: 9
phpVersion: 70100
checkMissingIterableValueType: false
scanDirectories:
- ../../oxid-esales
ignoreErrors:
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
- '#.*is not subtype of Throwable.*#'
paths:
- ./
level: 5
phpVersion: 80100
checkMissingIterableValueType: false