Compare commits

...

179 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 347e551194 merge rel_1.x changelog 2023-05-23 11:49:09 +02:00
MaxBUhe 000c49c56b bump version && changelog to 2.5.0 2023-05-23 11:32:20 +02:00
MaxBUhe 002cc69d2a switch metadata entries; fix getPrice-bug 2023-05-23 10:06:21 +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 27798703b0 bump version && changelog to 2.4.0 2023-05-02 14:36:52 +02:00
Christoph Staeblein 8eb734be8a OXID UserCentrics support, general overhaul for cookie managers 2023-05-02 14:28:47 +02:00
MaxBUhe 616f31ecba Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-03-20 15:46:58 +01:00
MaxBUhe 527eec1355 bump changelog 2023-03-20 11:01:03 +01:00
MaxBUhe 1966d3008e Merge remote-tracking branch 'remotes/origin/rel_2.x_custB' into rel_2.x 2023-03-20 10:56:29 +01:00
MaxBUhe bd51b37159 hot-fix: add missing view_item file; add metadata entry 2023-03-20 09:49:49 +01:00
MaxBuhe01 718b60e12c Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-03-17 15:31:34 +01:00
MaxBuhe01 d4df87bfff Merge remote-tracking branch 'remotes/origin/rel_1.x' into rel_2.x 2023-03-17 15:30:03 +01:00
MaxBUhe 63007e9b02 bump version 2023-03-10 11:25:12 +01:00
MaxBUhe 5fe656988c genuine cleaning off of unnecessary files (prevent confusion) 2023-03-10 11:22:49 +01:00
MaxBUhe 9cb3a54824 Merge remote-tracking branch 'remotes/origin/rel_2.x' 2023-02-22 14:35:22 +01:00
MaxBUhe 2f6fd8a31c bump version 2023-02-22 14:31:28 +01:00
MaxBUhe 8f9ed021d6 bump version 2023-02-22 14:07:14 +01:00
MaxBUhe 0ef3d3373a Merge remote-tracking branch 'remotes/origin/dev/view_cart/illegal_character_U+20AC' into rel_2.x 2023-02-22 14:05:56 +01:00
MaxBUhe fd2b4a5bbe add special price formatting 2023-02-22 13:46:27 +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
MaxBuhe01 1c45a16356 bump version 2023-02-21 12:27:52 +01:00
MaxBUhe 1589f202a9 add own cookie-check method; rm unnecessary help-text 2023-02-21 12:09:04 +01:00
MaxBUhe 55bd7b7fb4 adjust module_options meta-docs 2023-02-01 14:27:49 +01:00
MaxBUhe 3c1e6a11ff bump version 2023-01-27 13:47:13 +01:00
MaxBUhe 9ac78a0d43 OST:#573111 fix bug - missing use 2023-01-27 13:43:29 +01:00
MaxBUhe e2bcb34051 bump version 2023-01-27 11:11:09 +01:00
MaxBUhe 4ea0c19d7b Merge remote-tracking branch 'remotes/origin/rel_1.x' into rel_2.x 2023-01-27 11:04:23 +01:00
MaxBUhe 56740f1f10 rm unnecessary method call in gtm_js.tpl 2023-01-27 09:19:05 +01:00
MaxBUhe daed30a585 rm unnecessary entries in metadata 2023-01-27 09:07:22 +01:00
MaxBUhe 48d411ac3f switch head-meta-infos 2023-01-27 09:07:09 +01:00
MaxBUhe b530366cb8 rm unnecessary lang file 2023-01-27 09:06:49 +01:00
MaxBUhe 975d07056a cleaning off branding 2023-01-27 08:59:06 +01:00
MaxBUhe 24bf113d30 switch comment in changelog of 2.0 2023-01-26 09:20:56 +01:00
MaxBUhe ca6a810fa3 add 1.0 section to changelog 2023-01-26 09:16:51 +01:00
MaxBUhe 62b382eadf adding tech-docs; rm unnecessary sections in readme; fixing wrong links 2023-01-26 09:15:10 +01:00
MaxBUhe 45d8e45137 fix missing entries in changelog 2023-01-25 10:58:24 +01:00
MaxBUhe 70f2308575 extend changelog and readme 2023-01-25 10:48:02 +01:00
MaxBUhe 6eb15ec080 add block description 2023-01-20 14:31:39 +01:00
MaxBUhe d722c46a74 bump metadata-version 2023-01-20 11:26:09 +01:00
MaxBUhe d847a34e99 set compatibility to oxid 6.5 and above 2023-01-20 11:24:30 +01:00
MaxBUhe 7b55d1d57c adjust requirements 2023-01-20 11:18:48 +01:00
MaxBUhe a25be1069c rework code to actually fit 6.0.x && 6.1x 2023-01-20 11:18:17 +01:00
MaxBUhe 5200232a32 Merge remote-tracking branch 'remotes/origin/rel_1.x' into dev_1.x_OXID_6.3 2023-01-20 11:11:17 +01:00
MaxBUhe bcd785774b adjusting composer.json to fit corresponding shop-version 2022-12-22 08:56:45 +01:00
MaxBUhe 5ba613df30 add currency to the params 2022-12-21 11:12:35 +01:00
MaxBUhe a1dc0a6a58 fix bug that'd fail in wave and fail iIndex 2022-12-09 14:51:45 +01:00
54 changed files with 1587 additions and 361 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,10 +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?',
'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_cookieName' => 'CookieID',
'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="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{strip}][{capture assign=d3_ga4_view_cart}]
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()}],
'items': [
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
{
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
'price': [{$d3oItemPrice->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,36 +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->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')}]',
'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}]
]
}
})
</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,26 +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->getFieldData("oxtitle")}]',
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'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->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
'price': [{$d3PriceObject->getPrice()}]
}
]
}
});
</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,56 +0,0 @@
[{$smarty.block.parent}]
[{assign var="d3ProductObject" value=$oView->getProduct()}]
[{assign var="d3PriceObject" value=$d3ProductObject->getPrice()}]
[{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*[{$d3PriceObject->getPrice()}],
'items': [
{
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}],
'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] || '',
'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,33 +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="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}]',
'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,36 +0,0 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{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="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}]',
'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,203 @@ 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
- usercentrics defined script attributes
- cookie-manager evaluation
### Changed
- genuine clean up of base-js-files
## [2.3.3](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.2...2.3.3) - 2023-03-20
### Fixed
- metadata file path for view_item
## [2.3.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.2...2.3.2) - 2023-03-17
### Added
- Aggrosoft-Cookie-Consent compatibility
### Fixed
- wrong function for pageview on thankyou page
### Deleted
- unused files
## [2.2.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.1...2.2.2) - 2023-02-22
### Fixed
- price formatting in view_cart
## [2.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1.1...2.2.1) - 2023-02-21
### Added
- cookie handling
## [2.1.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1...2.1.1) - 2023-01-27
### Fixed
- add missing class import
## [2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.0...2.1) - 2023-01-27
### Added
- block section for add_to_basket js
- template block order positions
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
### 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

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: page_list_productlist (muss hinzugefĂĽgt werden)
- Datei: page/list/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
@ -65,4 +48,18 @@ Aktivieren Sie anschlieĂźend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
- In der Usercentrics-Verwaltung die Services "Google Analytics" und "Google Tag Manager" anlegen
- Den Service ```Google Tag Manager``` in den Moduleinstellungen des 'Google Analytics 4' unter
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
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,9 +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
{
@ -27,54 +34,32 @@ class ViewConfig extends ViewConfig_parent
{
if ($this->sContainerId === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
$this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_sContainerID', 'd3googleanalytics4');
}
return $this->sContainerId;
}
/**
* @return mixed
* @return void
*/
public function getModuleSettingExplicitManagerSelectValue()
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
}
/**
* @return false|mixed
*/
public function getExplicitManager()
{
$sManagerName = $this->getModuleSettingExplicitManagerSelectValue();
return $sManagerName === "NONE" ? false : $sManagerName;
}
public function getCookieManagerType()
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();
}
if ($this->sCookieManagerType === false and $this->getExplicitManager()){
return "externalService";
}
return $this->sCookieManagerType;
}
/**
* @return bool
*/
public function shallUseOwnCookieManager() :bool
{
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
}
/**
@ -86,34 +71,43 @@ class ViewConfig extends ViewConfig_parent
$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 or consentmanager
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'externalService') {
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;
}
@ -122,29 +116,33 @@ class ViewConfig extends ViewConfig_parent
* This is especially important for UserCentrics.
* @return string
*/
public function getGtmScriptAttributes()
public function getGtmScriptAttributes() :string
{
$oConfig = Registry::getConfig();
$sControlParameter = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_controlParameter'));
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'USERCENTRICS') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) {
return 'data-usercentrics="' . $sCookieId . '" type="text/plain" async=""';
}
if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){
return "";
}
if ($this->getCookieManagerType() === "externalService" and $this->getExplicitManager() === 'CONSENTMANAGER') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if (
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
)
{
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
}
if ($sCookieId) {
return 'async
type="text/plain"
data-cmp-src="https://www.googletagmanager.com/gtm.js?id='.$this->getGtmContainerId().'"
class="cmplazyload"
data-cmp-vendor="s905"
';
}
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 "";
@ -152,11 +150,18 @@ class ViewConfig extends ViewConfig_parent
private $blGA4enabled = null;
/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function isGA4enabled()
{
if ($this->blGA4enabled === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_blEnableGA4');
$this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_blEnableGA4', 'd3googleanalytics4');
}
return $this->blGA4enabled;
@ -168,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();
@ -191,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

@ -23,16 +23,16 @@ Dieses Paket erfordert einen mit Composer installierten OXID eShop in einer in d
Ă–ffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). FĂĽhren Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
```bash
php composer require d3/google-analytics4:^1
php composer require d3/google-analytics4:^2
```
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
> ### Wichtig!
> Bitte stellen Sie sicher, dass die nötigen Blöcke im OXID-Shop zur Verfügung stehen.
> Lesen Sie mehr in der [technischen Doku](./Docs/README.md) unter "Blöcke"!
### 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

View File

@ -45,8 +45,9 @@
},
"require": {
"php": ">=7.1",
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
"google/apiclient":" ^2.0"
"oxid-esales/oxideshop-ce": "^6.5",
"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,18 +48,50 @@ $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' => '1.7.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
@ -55,33 +118,52 @@ $aModule = [
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => '/Application/views/blocks/checkout_s1.tpl'
'file' => '/Application/views/blocks/view_cart.tpl'
],
[
'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
[
'template' => 'page/list/list.tpl',
'block' => 'page_list_productlist',
'file' => '/Application/views/ga4/view_item_list.tpl',
'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,9 +198,9 @@ $aModule = [
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_cookieName',
'name' => 'd3_gtm_settings_controlParameter',
'type' => 'str',
'value' => 'example',
'value' => '',
'position' => 999
],
[
@ -126,7 +208,7 @@ $aModule = [
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
'type' => 'select',
'value' => 'none',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS',
'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