8
0

Commits vergleichen

..

65 Commits

Autor SHA1 Nachricht Datum
59ef1d0625 [Added] extended Doks 2024-01-22 14:30:59 +01:00
e4969f2cbd [Changed] phpstan.neon 2024-01-22 14:23:09 +01:00
13ef2bef7b [Changed] phpstan.neon 2024-01-22 11:27:04 +01:00
59f0e37cce bump changelog && version to 2.14.0 2024-01-22 11:16:16 +01:00
bcf38a6e11 Merge remote-tracking branch 'remotes/origin/rel_1.x' into dev_2.x 2024-01-22 11:13:05 +01:00
31b3474cfd [Bump] metadata && changelog 2024-01-22 09:09:26 +01:00
1a641de8fc [Added] PHPStan lvl 5, error-ignoring; [Fixed] user-Getter evaluation 2024-01-19 11:54:48 +01:00
268cf6f6da [Working] set PHPStan to lvl 5 2024-01-17 16:07:41 +01:00
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
1c1080923b [Changed] phpStan - set level to 3, clean files by level 2024-01-17 15:36:43 +01:00
007e83909b [Added] search controller extension (add_to_cart) 2024-01-17 15:32:59 +01:00
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
a990834da4 [Added] missing IntelliSenseHelper entry for Manufacturer 2024-01-02 13:19:20 +01:00
6047f72edf [Added] phpstan + phpstan file 2024-01-02 11:54:07 +01:00
e2564f613a [Changed] capture implementation
reworked to a safer path-through to get the data
2023-12-18 11:59:12 +01:00
9ea5408e44 [Added] add_to_cart to start-template 2023-12-18 11:23:43 +01:00
ab6b7f7454 [Added] add_to_cart to recommlist, wishlist, noticelist, Class-Extensions for corresponding templates 2023-11-07 15:23:40 +01:00
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
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
5ac3385b53 [Added] add_to_cart to page/list/list.tpl 2023-11-02 13:36:44 +01:00
5c98d99d80 bump metadata && changelog 2023-09-13 16:02:49 +02:00
da2966626e cleaning; adjust not set param handling 2023-09-13 15:15:49 +02:00
6fcee0671f adjust set-param check 2023-09-13 15:15:22 +02:00
f64eb35763 switch control-param name 2023-09-13 15:09:27 +02:00
b2d8d597fd switch name of control-parameter; switch consentmanager-script-adjustments
# Conflicts:
#	Modules/Core/ViewConfig.php
2023-09-13 15:02:50 +02:00
36ac641233 adjust Doku with further infos new cookieid -> Control parameter 2023-09-13 15:00:44 +02:00
99af4cdfa9 bump metadata && changelog 2023-09-07 15:16:54 +02:00
eb2c7f73b9 add cookiebot essentials 2023-09-07 15:15:05 +02:00
575e35ffbc [changed] 'an article has been removed from basket'-check 2023-08-18 14:07:53 +02:00
2e6acbe675 [fixed] metadata class entry 2023-08-17 10:59:57 +02:00
aae6c43786 extends changelog 2023-08-17 10:30:19 +02:00
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
a49c29d7aa add CountryObjectGetter to ThankYouController 2023-08-17 09:20:58 +02:00
e90aba2c55 add gitignore 2023-08-17 08:53:00 +02:00
ea6b63fd2f extended docs 2023-08-17 08:53:00 +02:00
6b18c50b42 add 'remove_from_cart' event 2023-08-17 08:53:00 +02:00
443b456a0d add new method for debug-check 2023-08-17 08:53:00 +02:00
216c53fa90 general structure rework, debug_mode setter 2023-08-17 08:52:58 +02:00
5355b0a7ad extend Manufacturer 2023-08-15 11:59:27 +02:00
432ba54c84 bump version && changelog to 1.10.0 2023-06-27 09:48:29 +02:00
8b344ffb85 add cookiefirst 2023-06-27 09:39:43 +02:00
0009926313 revert php adjustment in composer.json 2023-06-27 09:30:10 +02:00
50be757355 reduce minimal usable php to 7.0 2023-06-27 09:08:17 +02:00
60f61f4bab [working state] add rel_2.x adjustments 2023-06-26 17:45:26 +02:00
a93b1cf582 [working state] add rel_2.x adjustments 2023-06-26 17:41:00 +02:00
3f59d1f210 bump version && changelog to 1.9.0 2023-06-19 14:50:34 +02:00
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
d4ef0f35f9 bump version && changelog to 1.8.0 2023-05-31 14:22:11 +02:00
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
32e08a88ca rm typo in readme 2023-05-31 10:29:49 +02:00
9d9daf9a85 bump version && changelog to 1.7.0 2023-05-31 10:28:19 +02:00
6eefc062ba add missing article-getter 2023-05-31 10:17:51 +02:00
3f89e26bde adjust readme and switch used block-extension 2023-05-30 16:41:59 +02:00
e624cfdfcb bump version && changelog to 1.6.0 2023-05-30 08:56:19 +02:00
e2cdda530b adjusted usercentrics script 2023-05-26 13:49:50 +02:00
3e65d05c0b added position to block-extension 2023-05-24 11:09:36 +02:00
561a2101f1 [working-state] restructuring usercentricts & consentmanager decision
consentmanager decision is working so far; next step is implementing usercentricts
2023-05-23 14:52:07 +02:00
6fca52cc06 add usercentrics chosable settings-value; add additional methods; add new multilang-idents 2023-05-23 14:33:35 +02:00
dfdc5d5edf bump version && changelog to 1.5.0 2023-05-23 11:44:07 +02:00
ae6f9bfaa9 switch php-file-header hint 2023-05-23 10:49:59 +02:00
1d9e09b8b1 switch view_item and item_list template 2023-05-23 10:49:05 +02:00
f9a0834d26 add settings-entry; add consentmanager-option 2023-05-16 14:42:12 +02:00
bb70cda626 fix unnecessary convert of int to str 2023-05-16 14:41:47 +02:00
c9a1174c98 genuine code cleanup; switch hard-getter to methods and use price-object
# Conflicts:
#	Application/views/blocks/view_item.tpl
#	Application/views/ga4/add_to_cart.tpl
2023-05-16 14:41:32 +02:00
Christoph Staeblein
f3b2911679 OXID UserCentrics support, general overhaul for cookie managers 2023-05-16 14:24:50 +02:00
42 geänderte Dateien mit 823 neuen und 275 gelöschten Zeilen

1
.gitignore vendored Normale Datei
Datei anzeigen

@ -0,0 +1 @@
.idea

Datei anzeigen

@ -31,11 +31,11 @@ $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>
'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.',

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,56 +1,3 @@
[{$smarty.block.parent}]
[{block name="d3_ga4_purchase_block"}]
[{capture assign=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)}]',
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
'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=$d3_ga4_purchase}]
[{/block}]
[{include file="event/purchase.tpl"}]

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,50 +1,3 @@
[{$smarty.block.parent}]
[{*$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 assign=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)}]',
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
'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=$d3_ga4_view_cart}]
[{/block}]
[{include file="event/view_cart.tpl"}]

Datei anzeigen

@ -1,40 +1,3 @@
[{$smarty.block.parent}]
[{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 assign=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)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
'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=$d3_ga4_view_item}]
[{/block}]
[{include file="event/view_item.tpl"}]

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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}]

Datei anzeigen

@ -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}]

Datei anzeigen

@ -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}]

Datei anzeigen

@ -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}]

Datei anzeigen

@ -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}]

Datei anzeigen

@ -1,4 +1,3 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
@ -6,7 +5,7 @@
[{block name="d3_ga4_view_item_list_block"}]
[{if $gtmProducts|@count}]
[{capture assign=d3_ga4_view_item_list}]
[{capture name="d3_ga4_view_item_list"}]
[{strip}]
dataLayer.push({ecommerce: null});
dataLayer.push({
@ -26,10 +25,10 @@
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
'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}]
@ -41,6 +40,6 @@
});
[{/strip}]
[{/capture}]
[{oxscript add=$d3_ga4_view_item_list}]
[{oxscript add=$smarty.capture.d3_ga4_view_item_list}]
[{/if}]
[{/block}]

Datei anzeigen

@ -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'}]

Datei anzeigen

@ -1,52 +0,0 @@
[{$smarty.block.parent}]
[{* variable $gtmProduct is passed from parent tempalte *}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{block name="d3_ga4_add_to_cart_block"}]
[{capture assign=d3_ga4_add_to_cart}]
[{strip}]
$("#toBasket").click(function(event) {
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{*** 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}]',
[{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
[{/if}]
'quantity': iArtQuantity
}
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
});
[{/strip}]
[{/capture}]
[{oxscript add=$d3_ga4_add_to_cart}]
[{/block}]

Datei anzeigen

@ -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"}]

Datei anzeigen

@ -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"}]

Datei anzeigen

@ -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"}]

Datei anzeigen

@ -4,8 +4,16 @@ 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.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
### 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
@ -129,6 +137,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
### Added
- using of ContainerFactory in ViewConfig
## [1.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

Datei anzeigen

@ -1,6 +1,6 @@
# 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/
@ -10,34 +10,7 @@ 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)
## 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
> 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.
@ -76,7 +49,7 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
- In der Usercentrics-Verwaltung die Services "Google Analytics" und "Google Tag Manager" anlegen
- Den Service ```Google Tag Manager``` in den Moduleinstellungen des 'Google Analytics 4' unter
Google Tag Manager eintragen
-
- [Consent Management Provider](https://www.consentmanager.net/)
- In der Consentmanager-Oberfläche den Anbieter "Google Tag Manager" mit der ID s905 hinzufügen
- Im Frontend, im consentmanager-Pop-up nach dem 'Google Tag Manager' suchen
@ -84,6 +57,9 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
- 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
- [Cookiebot](https://www.cookiebot.com)
- Nähere Informationen folgen bald! Bis dato, besuchen Sie bitte die offizielle Webseite.
- [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

Datei anzeigen

@ -20,8 +20,39 @@ namespace D3\GoogleAnalytics4\Modules\Core{
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\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 {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Component{
use OxidEsales\Eshop\Application\Component\BasketComponent;
class d3GtmBasketComponentExtension_parent extends BasketComponent {}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -11,7 +11,7 @@ use oxSystemComponentException;
class BasketController extends BasketController_parent
{
/**
* @throws oxSystemComponentException
* @return string
*/
public function render()
{
@ -33,22 +33,18 @@ class BasketController extends BasketController_parent
$aProducts = Registry::getRequest()->getRequestEscapedParameter('aproducts');
// collecting specified item
$sProductId = $sProductId ?? Registry::getRequest()->getRequestEscapedParameter('aid');
$sProductId = Registry::getRequest()->getRequestEscapedParameter('aid');
if ($sProductId) {
// additionally fetching current product info
$dAmount = $dAmount ?? Registry::getRequest()->getRequestEscapedParameter('am');
$dAmount = Registry::getRequest()->getRequestEscapedParameter('am');
// select lists
$aSel = $aSel ?? Registry::getRequest()->getRequestEscapedParameter('sel');
$aSel = Registry::getRequest()->getRequestEscapedParameter('sel');
// persistent parameters
if (empty($aPersParam)) {
/** @var BasketComponent $oBasketComponent */
$oBasketComponent = $this->getComponent('oxcmp_basket');
/** @var BasketComponent $oBasketComponent */
$oBasketComponent = $this->getComponent('oxcmp_basket');
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
}
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
$sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex');
@ -124,4 +120,4 @@ class BasketController extends BasketController_parent
return false;
}
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -7,7 +7,7 @@ use OxidEsales\Eshop\Application\Model\Payment;
class Basket extends Basket_parent
{
/**
* @return void
* @return string
*/
public function getPaymentOnPaymentId() :string
{

Datei anzeigen

@ -8,9 +8,9 @@ class Category extends Category_parent
* @param int $indexOfArray
* @return string
*/
public function getSplitCategoryArray(int $indexOfArray = -1) :string
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
{
if ($indexOfArray > -1){
if ($bShallTakeStd){
$splitCatArray =
array_values(
array_filter(
@ -26,7 +26,7 @@ class Category extends Category_parent
)
);
if ($splitCatArray[$indexOfArray]){
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
return $splitCatArray[$indexOfArray];
}else{
return "";

Datei anzeigen

@ -8,9 +8,9 @@ class Manufacturer extends Manufacturer_parent
* @param int $indexOfArray
* @return string
*/
public function getSplitCategoryArray(int $indexOfArray = -1) :string
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
{
if ($indexOfArray > -1){
if ($bShallTakeStd){
$splitCatArray =
array_values(
array_filter(
@ -26,7 +26,7 @@ class Manufacturer extends Manufacturer_parent
)
);
if ($splitCatArray[$indexOfArray]){
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
return $splitCatArray[$indexOfArray];
}else{
return "";

Datei anzeigen

@ -16,7 +16,7 @@ use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Model\User;use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
use Psr\Container\ContainerExceptionInterface;
@ -174,7 +174,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();
@ -197,8 +197,8 @@ 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"
];

Datei anzeigen

@ -46,8 +46,8 @@
"require": {
"php": ">=7.1",
"oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0"
},
"google/apiclient":" ^2.0",
"phpstan/phpstan": "^1.10" },
"autoload": {
"psr-4": {
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"

Datei anzeigen

@ -1,11 +1,29 @@
<?php
use D3\GoogleAnalytics4\Modules\Application\Component\d3GtmBasketComponentExtension;
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\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\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\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;
@ -26,18 +44,42 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
",
'thumbnail' => 'thumbnail.png',
'version' => '2.13.1',
'version' => '2.14.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
'extend' => [
OEViewConfig::class => ViewConfig::class,
OECategory::class => Category::class,
OEManufacturer::class => Manufacturer::class,
OEBasket::class => Basket::class,
OEBasketController::class => BasketController::class
OEViewConfig::class => ViewConfig::class,
OECategory::class => Category::class,
OEBasket::class => Basket::class,
OEBasketController::class => BasketController::class,
OEManufacturer::class => Manufacturer::class,
OEThankYouController::class => ThankYouController::class,
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
OEBasketComponent::class => d3GtmBasketComponentExtension::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
],
'templates' => [
// 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',
],
'templates' => [],
'blocks' => [
// tag manager js
[
@ -75,28 +117,40 @@ $aModule = [
[
'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/view_search_result.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/ga4/remove_from_cart.tpl',
'file' => '/Application/views/blocks/remove_from_cart.tpl',
'position' => 150
]
],

Datei anzeigen

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