Merge remote-tracking branch 'remotes/origin/rel_2.x'
This commit is contained in:
commit
154147b8d8
@ -36,6 +36,8 @@ class ManagerTypes
|
|||||||
|
|
||||||
const COOKIEFIRST = "COOKIEFIRST";
|
const COOKIEFIRST = "COOKIEFIRST";
|
||||||
|
|
||||||
|
const COOKIEBOT = "COOKIEBOT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -48,7 +50,8 @@ class ManagerTypes
|
|||||||
"oxps_usercentrics" => self::USERCENTRICS_MODULE,
|
"oxps_usercentrics" => self::USERCENTRICS_MODULE,
|
||||||
"usercentrics" => self::USERCENTRICS_MANUALLY,
|
"usercentrics" => self::USERCENTRICS_MANUALLY,
|
||||||
"consentmanager" => self::CONSENTMANAGER,
|
"consentmanager" => self::CONSENTMANAGER,
|
||||||
"cookiefirst" => self::COOKIEFIRST
|
"cookiefirst" => self::COOKIEFIRST,
|
||||||
|
"cookiebot" => self::COOKIEBOT,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,5 +43,6 @@ $aLang = [
|
|||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_COOKIEFIRST' => 'cookiefirst',
|
'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_cookieName' => 'CookieID',
|
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
||||||
];
|
];
|
||||||
|
@ -1,51 +1,56 @@
|
|||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
[{strip}]
|
[{block name="d3_ga4_purchase_block"}]
|
||||||
<script>
|
[{capture assign=d3_ga4_purchase}]
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
[{strip}]
|
||||||
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
||||||
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
||||||
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
||||||
|
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
||||||
|
|
||||||
dataLayer.push({
|
dataLayer.push({
|
||||||
'event': 'purchase',
|
'event': 'purchase',
|
||||||
'eventLabel':'Checkout Step 5',
|
'eventLabel':'Checkout Step 5',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
|
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
|
||||||
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
||||||
'value': [{$gtmOrder->getTotalOrderSum()}],
|
'value': [{$gtmOrder->getTotalOrderSum()}],
|
||||||
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
|
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
|
||||||
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
|
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
|
||||||
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
||||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||||
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
||||||
'items': [
|
'items': [
|
||||||
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
||||||
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
||||||
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
||||||
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
||||||
|
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
||||||
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||||
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||||
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
||||||
[{if $gtmPurchaseItemCategory}]
|
[{if $gtmPurchaseItemCategory}]
|
||||||
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
||||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||||
[{/if}]
|
[{/if}]
|
||||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
]
|
]
|
||||||
}
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
})
|
'debug_mode': 'true'
|
||||||
</script>
|
[{/if}]
|
||||||
[{/strip}]
|
})
|
||||||
|
[{/strip}]
|
||||||
|
[{/capture}]
|
||||||
|
[{oxscript add=$d3_ga4_purchase}]
|
||||||
|
[{/block}]
|
@ -5,40 +5,46 @@
|
|||||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||||
|
|
||||||
[{strip}][{capture assign=d3_ga4_view_cart}]
|
[{block name="d3_ga4_view_cart_block"}]
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
[{capture assign=d3_ga4_view_cart}]
|
||||||
dataLayer.push({
|
[{strip}]
|
||||||
'event': 'view_cart',
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
'eventLabel':'Checkout Step 1',
|
dataLayer.push({
|
||||||
'ecommerce': {
|
'event': 'view_cart',
|
||||||
'actionField': "step: 1",
|
'eventLabel':'Checkout Step 1',
|
||||||
'currency': "[{$currency->name}]",
|
'ecommerce': {
|
||||||
'value': [{$d3BasketPrice->getPrice()}],
|
'actionField': "step: 1",
|
||||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
'currency': "[{$currency->name}]",
|
||||||
'items': [
|
'value': [{$d3BasketPrice->getPrice()}],
|
||||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||||
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
'items': [
|
||||||
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
|
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||||
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
|
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
||||||
{
|
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
|
||||||
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
|
||||||
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
{
|
||||||
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
||||||
[{if $gtmBasketItemCategory}]
|
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
||||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
||||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
[{if $gtmBasketItemCategory}]
|
||||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
||||||
[{/if}]
|
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
||||||
'price': [{$d3oItemPrice->getPrice()}],
|
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
[{/if}]
|
||||||
'quantity': [{$basketitem->getAmount()}],
|
'price': [{$d3oItemPrice->getPrice()}],
|
||||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||||
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
'quantity': [{$basketitem->getAmount()}],
|
||||||
[{/foreach}]
|
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||||
]
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
||||||
}
|
[{/foreach}]
|
||||||
});
|
]
|
||||||
[{/capture}][{/strip}]
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
[{oxscript add=$d3_ga4_view_cart}]
|
'debug_mode': 'true'
|
||||||
|
[{/if}]
|
||||||
|
});
|
||||||
|
[{/strip}]
|
||||||
|
[{/capture}]
|
||||||
|
[{oxscript add=$d3_ga4_view_cart}]
|
||||||
|
[{/block}]
|
@ -3,31 +3,38 @@
|
|||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
|
|
||||||
<script>
|
[{block name="d3_ga4_view_item_block"}]
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
[{capture assign=d3_ga4_view_item}]
|
||||||
|
[{strip}]
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
|
||||||
dataLayer.push({
|
dataLayer.push({
|
||||||
'event': 'view_item',
|
'event': 'view_item',
|
||||||
'eventLabel':'Product View',
|
'eventLabel':'Product View',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'currency': '[{$currency->name}]',
|
'currency': '[{$currency->name}]',
|
||||||
'items': [
|
'items': [
|
||||||
{
|
{
|
||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||||
[{if $gtmCategory}]
|
[{if $gtmCategory}]
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
'price': [{$d3PriceObject->getPrice()}]
|
'price': [{$d3PriceObject->getPrice()}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
});
|
'debug_mode': 'true'
|
||||||
</script>
|
[{/if}]
|
||||||
|
});
|
||||||
|
[{/strip}]
|
||||||
|
[{/capture}]
|
||||||
|
[{oxscript add=$d3_ga4_view_item}]
|
||||||
|
[{/block}]
|
@ -6,43 +6,47 @@
|
|||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||||
|
|
||||||
[{capture assign=d3_ga4_add_to_cart}]
|
[{block name="d3_ga4_add_to_cart_block"}]
|
||||||
[{block name="d3_ga4_add_to_basket"}]
|
[{capture assign=d3_ga4_add_to_cart}]
|
||||||
$("#toBasket").click(function(event) {
|
[{strip}]
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
$("#toBasket").click(function(event) {
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
|
||||||
[{*** Debug cases ***}]
|
[{*** Debug cases ***}]
|
||||||
[{*event.preventDefault();*}]
|
[{*event.preventDefault();*}]
|
||||||
|
|
||||||
let iArtQuantity = $("#amountToBasket").val();
|
let iArtQuantity = $("#amountToBasket").val();
|
||||||
|
|
||||||
dataLayer.push({
|
dataLayer.push({
|
||||||
'isAddToBasket': true,
|
'isAddToBasket': true,
|
||||||
'event':'add_to_cart',
|
'event':'add_to_cart',
|
||||||
'eventLabel': 'add_to_cart',
|
'eventLabel': 'add_to_cart',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'currency': "[{$currency->name}]",
|
'currency': "[{$currency->name}]",
|
||||||
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||||
'items': [
|
'items': [
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
||||||
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
||||||
'price': [{$d3PriceObject->getPrice()}],
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||||
[{if $gtmCategory}]
|
[{if $gtmCategory}]
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||||
[{/if}]
|
[{/if}]
|
||||||
'quantity': iArtQuantity
|
'quantity': iArtQuantity
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
});
|
'debug_mode': 'true'
|
||||||
});
|
[{/if}]
|
||||||
[{/block}]
|
});
|
||||||
|
});
|
||||||
|
[{/strip}]
|
||||||
[{/capture}]
|
[{/capture}]
|
||||||
[{oxscript add=$d3_ga4_add_to_cart}]
|
[{oxscript add=$d3_ga4_add_to_cart}]
|
||||||
|
[{/block}]
|
48
Application/views/ga4/remove_from_cart.tpl
Normal file
48
Application/views/ga4/remove_from_cart.tpl
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{block name="d3_ga4_remove_from_cart_block"}]
|
||||||
|
[{if $hasBeenReloaded}]
|
||||||
|
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||||
|
[{capture assign=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)}]',
|
||||||
|
'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': '[{$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=$d3_ga4_remove_from_cart}]
|
||||||
|
[{/if}]
|
||||||
|
[{/block}]
|
@ -4,39 +4,43 @@
|
|||||||
|
|
||||||
[{assign var="breadCrumb" value=''}]
|
[{assign var="breadCrumb" value=''}]
|
||||||
|
|
||||||
[{if $gtmProducts|@count}]
|
[{block name="d3_ga4_view_item_list_block"}]
|
||||||
[{strip}]
|
[{if $gtmProducts|@count}]
|
||||||
<script>
|
[{capture assign=d3_ga4_view_item_list}]
|
||||||
/* ga4 */
|
[{strip}]
|
||||||
dataLayer.push({ecommerce: null});
|
dataLayer.push({ecommerce: null});
|
||||||
dataLayer.push({
|
dataLayer.push({
|
||||||
'event':'view_item_list',
|
'event':'view_item_list',
|
||||||
'event_name': 'view_item_list',
|
'event_name': 'view_item_list',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'item_list_id': '[{$oView->getCategoryId()}]',
|
'item_list_id': '[{$oView->getCategoryId()}]',
|
||||||
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
||||||
'items': [
|
'items': [
|
||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'price': [{$d3PriceObject->getPrice()}],
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
[{if $gtmCategory}]
|
[{if $gtmCategory}]
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
[{/if}]
|
[{/if}]
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
]
|
]
|
||||||
}
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
});
|
'debug_mode': 'true'
|
||||||
</script>
|
[{/if}]
|
||||||
[{/strip}]
|
});
|
||||||
[{/if}]
|
[{/strip}]
|
||||||
|
[{/capture}]
|
||||||
|
[{oxscript add=$d3_ga4_view_item_list}]
|
||||||
|
[{/if}]
|
||||||
|
[{/block}]
|
@ -2,38 +2,43 @@
|
|||||||
|
|
||||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||||
|
|
||||||
[{if $gtmProducts|@count}]
|
[{block name="d3_ga4_view_search_result_block"}]
|
||||||
[{strip}]
|
[{if $gtmProducts|@count}]
|
||||||
<script>
|
[{capture assign=d3_ga4_view_search_result}]
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
[{strip}]
|
||||||
dataLayer.push({
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
'event': 'view_search_result',
|
dataLayer.push({
|
||||||
'eventLabel':'view_search_result',
|
'event': 'view_search_result',
|
||||||
'ecommerce': {
|
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
|
||||||
'search_term': '[{$searchparamforhtml}]',
|
'ecommerce': {
|
||||||
'items': [
|
'search_term': '[{$searchparamforhtml}]',
|
||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
'items': [
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
{
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
{
|
||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'price': [{$d3PriceObject->getPrice()}],
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
[{if $gtmCategory}]
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
[{if $gtmCategory}]
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
[{/if}]
|
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||||
'quantity': 1
|
[{/if}]
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
'quantity': 1
|
||||||
[{/foreach}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
]
|
[{/foreach}]
|
||||||
}
|
]
|
||||||
});
|
}[{if $oViewConf->isDebugModeOn()}],
|
||||||
</script>
|
'debug_mode': 'true'
|
||||||
[{/strip}]
|
[{/if}]
|
||||||
[{/if}]
|
});
|
||||||
|
[{/strip}]
|
||||||
|
[{/capture}]
|
||||||
|
[{oxscript add=$d3_ga4_view_search_result}]
|
||||||
|
[{/if}]
|
||||||
|
[{/block}]
|
16
CHANGELOG.md
16
CHANGELOG.md
@ -4,6 +4,22 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [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
|
## [2.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.2...2.10.0) - 2023-08-02
|
||||||
### Added
|
### Added
|
||||||
- new Event "remove_from_cart"
|
- new Event "remove_from_cart"
|
||||||
|
@ -73,4 +73,7 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
|
|||||||
- kleines Fragezeichen neben den Namen anklicken und ganz runter scrollen
|
- kleines Fragezeichen neben den Namen anklicken und ganz runter scrollen
|
||||||
- prüfen, ob ein Cookie vorgegeben ist
|
- prüfen, ob ein Cookie vorgegeben ist
|
||||||
- sonst, in der Consentmanager-Oberfläche Cookie-Liste entsprechendes Cookie suchen und im Admin unter
|
- sonst, in der Consentmanager-Oberfläche Cookie-Liste entsprechendes Cookie suchen und im Admin unter
|
||||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
```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.
|
@ -20,4 +20,8 @@ namespace D3\GoogleAnalytics4\Modules\Core{
|
|||||||
namespace D3\GoogleAnalytics4\Modules\Application\Model{
|
namespace D3\GoogleAnalytics4\Modules\Application\Model{
|
||||||
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
|
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
|
||||||
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
|
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace D3\GoogleAnalytics4\Modules\Application\Controller{
|
||||||
|
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
|
||||||
}
|
}
|
127
Modules/Application/Controller/BasketController.php
Normal file
127
Modules/Application/Controller/BasketController.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws oxSystemComponentException
|
||||||
|
*/
|
||||||
|
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 = $sProductId ?? Registry::getRequest()->getRequestEscapedParameter('aid');
|
||||||
|
if ($sProductId) {
|
||||||
|
// additionally fetching current product info
|
||||||
|
$dAmount = $dAmount ?? Registry::getRequest()->getRequestEscapedParameter('am');
|
||||||
|
|
||||||
|
// select lists
|
||||||
|
$aSel = $aSel ?? Registry::getRequest()->getRequestEscapedParameter('sel');
|
||||||
|
|
||||||
|
// persistent parameters
|
||||||
|
if (empty($aPersParam)) {
|
||||||
|
|
||||||
|
/** @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;
|
||||||
|
}
|
||||||
|
}
|
44
Modules/Application/Model/Manufacturer.php
Normal file
44
Modules/Application/Model/Manufacturer.php
Normal 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) :string
|
||||||
|
{
|
||||||
|
if ($indexOfArray > -1){
|
||||||
|
$splitCatArray =
|
||||||
|
array_values(
|
||||||
|
array_filter(
|
||||||
|
explode(
|
||||||
|
'/',
|
||||||
|
trim(
|
||||||
|
parse_url(
|
||||||
|
$this->getLink(),
|
||||||
|
5
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($splitCatArray[$indexOfArray]){
|
||||||
|
return $splitCatArray[$indexOfArray];
|
||||||
|
}else{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
trim(
|
||||||
|
parse_url(
|
||||||
|
$this->getLink(),
|
||||||
|
5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -105,6 +105,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
|
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
|
||||||
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER
|
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER
|
||||||
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST
|
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST
|
||||||
|
or $this->sCookieManagerType === ManagerTypes::COOKIEBOT
|
||||||
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -154,6 +155,10 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
return 'type="text/plain" data-cookiefirst-category="' . $sCookieId .'"';
|
return 'type="text/plain" data-cookiefirst-category="' . $sCookieId .'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->sCookieManagerType === ManagerTypes::COOKIEBOT){
|
||||||
|
return 'type="text/plain" data-cookieconsent="' . $sCookieId .'"';
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +214,11 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
|
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isDebugModeOn() :bool
|
||||||
|
{
|
||||||
|
return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug');
|
||||||
|
}
|
||||||
|
|
||||||
public function isPromotionList($listId)
|
public function isPromotionList($listId)
|
||||||
{
|
{
|
||||||
$oConfig = Registry::getConfig();
|
$oConfig = Registry::getConfig();
|
||||||
|
19
metadata.php
19
metadata.php
@ -1,10 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use D3\GoogleAnalytics4\Modules\Application\Controller\BasketController;
|
||||||
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
||||||
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
|
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 D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||||
|
use OxidEsales\Eshop\Application\Controller\BasketController as OEBasketController;
|
||||||
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
||||||
use OxidEsales\Eshop\Application\Model\Category as OECategory;
|
use OxidEsales\Eshop\Application\Model\Category as OECategory;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
|
||||||
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
||||||
|
|
||||||
$sMetadataVersion = '2.1';
|
$sMetadataVersion = '2.1';
|
||||||
@ -22,14 +26,16 @@ $aModule = [
|
|||||||
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
|
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',
|
'thumbnail' => 'thumbnail.png',
|
||||||
'version' => '2.10.0',
|
'version' => '2.12.0',
|
||||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||||
'email' => 'support@shopmodule.com',
|
'email' => 'support@shopmodule.com',
|
||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
'extend' => [
|
'extend' => [
|
||||||
OEViewConfig::class => ViewConfig::class,
|
OEViewConfig::class => ViewConfig::class,
|
||||||
OECategory::class => Category::class,
|
OECategory::class => Category::class,
|
||||||
OEBasket::class => Basket::class
|
OEManufacturer::class => Manufacturer::class,
|
||||||
|
OEBasket::class => Basket::class,
|
||||||
|
OEBasketController::class => BasketController::class
|
||||||
],
|
],
|
||||||
'templates' => [],
|
'templates' => [],
|
||||||
'blocks' => [
|
'blocks' => [
|
||||||
@ -85,6 +91,13 @@ $aModule = [
|
|||||||
'block' => 'details_productmain_tobasket',
|
'block' => 'details_productmain_tobasket',
|
||||||
'file' => '/Application/views/ga4/add_to_cart.tpl',
|
'file' => '/Application/views/ga4/add_to_cart.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
|
],
|
||||||
|
// remove_from_cart
|
||||||
|
[
|
||||||
|
'template' => 'page/checkout/basket.tpl',
|
||||||
|
'block' => 'checkout_basket_main',
|
||||||
|
'file' => '/Application/views/ga4/remove_from_cart.tpl',
|
||||||
|
'position' => 150
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
@ -128,7 +141,7 @@ $aModule = [
|
|||||||
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
|
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'value' => 'none',
|
'value' => 'none',
|
||||||
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST',
|
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT',
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
Loading…
Reference in New Issue
Block a user