Merge remote-tracking branch 'remotes/origin/rel_2.x'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
4f8fa7cdc9
@ -34,6 +34,8 @@ class ManagerTypes
|
|||||||
|
|
||||||
const CONSENTMANAGER = "CONSENTMANAGER";
|
const CONSENTMANAGER = "CONSENTMANAGER";
|
||||||
|
|
||||||
|
const COOKIEFIRST = "COOKIEFIRST";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -45,7 +47,8 @@ class ManagerTypes
|
|||||||
"net_cookie_manager" => self::NET_COOKIE_MANAGER,
|
"net_cookie_manager" => self::NET_COOKIE_MANAGER,
|
||||||
"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
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +31,17 @@ $aLang = [
|
|||||||
// for cookie manager settings
|
// for cookie manager settings
|
||||||
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
||||||
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
|
'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>
|
||||||
|
<a href="https://consentmanager.net/">Consentmanager</a><br>
|
||||||
|
<a href="https://usercentrics.com/">Usercentrics</a><br>
|
||||||
|
<a href="https://cookiefirst.com">Cookiefirst</a><br>
|
||||||
|
|
||||||
|
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>
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
|
||||||
Dann wählen Sie bitte die zutreffende aus.',
|
Dann wählen Sie bitte die zutreffende aus.',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
|
||||||
'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_cookieName' => 'CookieID',
|
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
||||||
];
|
];
|
||||||
|
@ -4,28 +4,22 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
[{if $oViewConf->D3blShowGtmScript()}]
|
[{if $oViewConf->D3blShowGtmScript()}]
|
||||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
[{if $oViewConf->getGtmContainerId()}]
|
||||||
<!-- Google Tag Manager -->
|
[{strip}]
|
||||||
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
<!-- Google Tag Manager -->
|
||||||
(function (w, d, s, l, i) {
|
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||||
w[l] = w[l] || [];
|
(function (w, d, s, l, i) {
|
||||||
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
w[l] = w[l] || [];
|
||||||
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
||||||
j.async = true;
|
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||||
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
j.async = true;
|
||||||
f.parentNode.insertBefore(j, f);
|
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
f.parentNode.insertBefore(j, f);
|
||||||
</script>
|
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||||
<!-- End Google Tag Manager -->
|
</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
[{/strip}]
|
||||||
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
|
||||||
[{* include file="ga4_view_item.tpl" gtmProduct=$oView->getProduct() *}]
|
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "search" }]
|
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "basket" }]
|
|
||||||
[{/if}]
|
|
||||||
[{/strip}][{/if}]
|
|
||||||
[{/if}]
|
[{/if}]
|
||||||
|
[{/if}]
|
||||||
|
|
||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
@ -1,33 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
|
|
||||||
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
|
||||||
|
|
||||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
|
||||||
|
|
||||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
|
||||||
[{strip}][{capture assign=d3_ga4_view_cart}]
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
dataLayer.push({
|
|
||||||
'event': 'view_cart',
|
|
||||||
'eventLabel':'Checkout Step 1',
|
|
||||||
'ecommerce': {
|
|
||||||
'actionField': "step: 1",
|
|
||||||
'currency': "[{$currency->name}]",
|
|
||||||
'value': [{$d3BasketPrice->getPrice()}],
|
|
||||||
'items': [
|
|
||||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
|
||||||
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
|
||||||
{
|
|
||||||
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
|
||||||
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
|
||||||
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
|
||||||
'price': [{$d3oItemPrice->getPrice()}],
|
|
||||||
'quantity':[{$basketitem->getAmount()}],
|
|
||||||
'position':[{$smarty.foreach.gtmCartContents.index}]
|
|
||||||
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
|
||||||
[{/foreach}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
[{/capture}][{/strip}]
|
|
||||||
[{oxscript add=$d3_ga4_view_cart}]
|
|
@ -1,36 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
|
|
||||||
[{strip}]
|
|
||||||
<script>
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
[{assign var="_gtmOrder" value=$oView->getOrder()}]
|
|
||||||
[{assign var="_gtmArticles" value=$_gtmOrder->getOrderArticles()}]
|
|
||||||
|
|
||||||
dataLayer.push({
|
|
||||||
'event': 'purchase',
|
|
||||||
'eventLabel':'Checkout Step 5',
|
|
||||||
'ecommerce': {
|
|
||||||
'transaction_id': '[{$_gtmOrder->getFieldData("oxordernr")}]',
|
|
||||||
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
|
||||||
'value': [{$_gtmOrder->getTotalOrderSum()}],
|
|
||||||
'tax': [{math equation="x+y" x=$_gtmOrder->getFieldData("oxartvatprice1") y=$_gtmOrder->getFieldData("oxartvatprice2") }],
|
|
||||||
'shipping': [{$_gtmOrder->getFieldData("oxdelcost")}],
|
|
||||||
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
|
|
||||||
'items':
|
|
||||||
[
|
|
||||||
[{foreach from=$_gtmArticles item="d3BasketArticle" name="gtmArticles"}]
|
|
||||||
[{assign var="d3oArticlePrice" value=$d3BasketArticle->getPrice()}]
|
|
||||||
{
|
|
||||||
'id': '[{$d3BasketArticle->getFieldData("oxartnum")}]',
|
|
||||||
'name': '[{$d3BasketArticle->getFieldData("oxtitle")}]',
|
|
||||||
'variant': '[{$d3BasketArticle->getFieldData("oxselvariant")}]',
|
|
||||||
'price': [{$d3oArticlePrice->getPrice()}],
|
|
||||||
'quantity': [{$d3BasketArticle->getFieldData("oxamount")}],
|
|
||||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
|
||||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
|
||||||
[{/foreach}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
[{/strip}]
|
|
49
Application/views/blocks/purchase.tpl
Normal file
49
Application/views/blocks/purchase.tpl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{strip}]
|
||||||
|
<script>
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
||||||
|
[{assign var="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")}]',
|
||||||
|
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
||||||
|
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
||||||
|
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
||||||
|
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
||||||
|
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||||
|
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||||
|
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||||
|
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||||
|
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||||
|
[{/foreach}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
[{/strip}]
|
42
Application/views/blocks/view_cart.tpl
Normal file
42
Application/views/blocks/view_cart.tpl
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
||||||
|
|
||||||
|
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||||
|
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||||
|
|
||||||
|
[{strip}][{capture assign=d3_ga4_view_cart}]
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
dataLayer.push({
|
||||||
|
'event': 'view_cart',
|
||||||
|
'eventLabel':'Checkout Step 1',
|
||||||
|
'ecommerce': {
|
||||||
|
'actionField': "step: 1",
|
||||||
|
'currency': "[{$currency->name}]",
|
||||||
|
'value': [{$d3BasketPrice->getPrice()}],
|
||||||
|
'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')}]',
|
||||||
|
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
||||||
|
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
||||||
|
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
||||||
|
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
||||||
|
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||||
|
'price': [{$d3oItemPrice->getPrice()}],
|
||||||
|
'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}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
[{/capture}][{/strip}]
|
||||||
|
[{oxscript add=$d3_ga4_view_cart}]
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
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',
|
||||||
@ -15,8 +16,12 @@
|
|||||||
'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_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
|
||||||
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||||
|
'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()}]',
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
'price': [{$d3PriceObject->getPrice()}]
|
'price': [{$d3PriceObject->getPrice()}]
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
$("#toBasket").click(function(event) {
|
$("#toBasket").click(function(event) {
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
|
||||||
let itemCategories = '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]'.split('/');
|
|
||||||
|
|
||||||
[{*** Debug cases ***}]
|
[{*** Debug cases ***}]
|
||||||
[{*event.preventDefault();*}]
|
[{*event.preventDefault();*}]
|
||||||
|
|
||||||
@ -32,10 +30,11 @@
|
|||||||
'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}]',
|
||||||
'item_category': itemCategories[0] || 'no category',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
'item_category_2':itemCategories[1] || '',
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
'item_category_3':itemCategories[2] || '',
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
'item_category_4':itemCategories[3] || '',
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
|
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||||
'quantity': iArtQuantity
|
'quantity': iArtQuantity
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
||||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||||
|
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
|
||||||
|
|
||||||
[{assign var="breadCrumb" value=''}]
|
[{assign var="breadCrumb" value=''}]
|
||||||
|
|
||||||
@ -12,8 +13,8 @@
|
|||||||
'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()}]
|
||||||
@ -24,7 +25,10 @@
|
|||||||
'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_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||||
|
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||||
|
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||||
|
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
|
8
Application/views/ga4/search.tpl → Application/views/ga4/view_search_result.tpl
Executable file → Normal file
8
Application/views/ga4/search.tpl → Application/views/ga4/view_search_result.tpl
Executable file → Normal file
@ -15,13 +15,17 @@
|
|||||||
[{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}]
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||||
{
|
{
|
||||||
'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_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
'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()}]',
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
31
CHANGELOG.md
31
CHANGELOG.md
@ -4,6 +4,23 @@ 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.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-27
|
||||||
|
### Added
|
||||||
|
- Cookiefirst usability
|
||||||
|
|
||||||
|
## [2.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-23
|
||||||
|
### Added
|
||||||
|
- Method to get the in order used Payment-Name
|
||||||
|
- Method to get the current Article Category
|
||||||
|
- Following Entries to dedicated event-templates
|
||||||
|
- coupon
|
||||||
|
- paymentType
|
||||||
|
- item_list_name
|
||||||
|
- item_category
|
||||||
|
### Changed
|
||||||
|
- all used template-files have a more dedicated name
|
||||||
|
- general code cleanup
|
||||||
|
|
||||||
## [2.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.6.0...2.7.0) - 2023-06-19
|
## [2.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.6.0...2.7.0) - 2023-06-19
|
||||||
### Changed
|
### Changed
|
||||||
- add_to_cart event template-structure
|
- add_to_cart event template-structure
|
||||||
@ -72,6 +89,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
- using of ContainerFactory in ViewConfig
|
- using of ContainerFactory in ViewConfig
|
||||||
|
|
||||||
|
## [1.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.9.0...1.10.0) - 2023-06-27
|
||||||
|
### Added
|
||||||
|
- Following Entries to dedicated event-templates
|
||||||
|
- coupon
|
||||||
|
- paymentType
|
||||||
|
- item_list_name
|
||||||
|
- item_category
|
||||||
|
- Method to get the in order used Payment-Name
|
||||||
|
- Method to get the current Article Category
|
||||||
|
### Changed
|
||||||
|
- cookieManager handling
|
||||||
|
- general template cleanup
|
||||||
|
- renaming the template to a more intuitive name
|
||||||
|
|
||||||
## [1.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.8.0...1.9.0) - 2023-06-19
|
## [1.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.8.0...1.9.0) - 2023-06-19
|
||||||
### Changed
|
### Changed
|
||||||
- add_to_cart event template-structure
|
- add_to_cart event template-structure
|
||||||
|
@ -15,4 +15,9 @@
|
|||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Core{
|
namespace D3\GoogleAnalytics4\Modules\Core{
|
||||||
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
|
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace D3\GoogleAnalytics4\Modules\Application\Model{
|
||||||
|
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
|
||||||
|
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
|
||||||
}
|
}
|
23
Modules/Application/Model/Basket.php
Normal file
23
Modules/Application/Model/Basket.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Application\Model\Payment;
|
||||||
|
|
||||||
|
class Basket extends Basket_parent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getPaymentOnPaymentId() :string
|
||||||
|
{
|
||||||
|
if ($this->getPaymentId()){
|
||||||
|
$oPayment = oxNew(Payment::class);
|
||||||
|
if ($oPayment->load($this->getPaymentId())){
|
||||||
|
return $oPayment->getFieldData('oxdesc');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "couldn't load payment!";
|
||||||
|
}
|
||||||
|
}
|
44
Modules/Application/Model/Category.php
Normal file
44
Modules/Application/Model/Category.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||||
|
|
||||||
|
class Category extends Category_parent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param int $indexOfArray
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSplitCategoryArray(int $indexOfArray = -1) :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
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -82,7 +82,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
|
|
||||||
$this->defineCookieManagerType();
|
$this->defineCookieManagerType();
|
||||||
|
|
||||||
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
$sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_cookieName'));
|
||||||
|
|
||||||
// Netensio Cookie Manager
|
// Netensio Cookie Manager
|
||||||
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
|
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
|
||||||
@ -104,6 +104,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
|
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
|
||||||
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::EXTERNAL_SERVICE
|
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -121,8 +122,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
*/
|
*/
|
||||||
public function getGtmScriptAttributes() :string
|
public function getGtmScriptAttributes() :string
|
||||||
{
|
{
|
||||||
$oConfig = Registry::getConfig();
|
$sCookieId = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_cookieName'));
|
||||||
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
|
||||||
|
|
||||||
if (false === $this->shallUseOwnCookieManager()){
|
if (false === $this->shallUseOwnCookieManager()){
|
||||||
return "";
|
return "";
|
||||||
@ -150,6 +150,10 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
|
||||||
|
return 'type="text/plain" data-cookiefirst-category="' . $sCookieId .'"';
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
metadata.php
26
metadata.php
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
||||||
|
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
|
||||||
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
||||||
|
use OxidEsales\Eshop\Application\Model\Category as OECategory;
|
||||||
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
||||||
|
|
||||||
$sMetadataVersion = '2.1';
|
$sMetadataVersion = '2.1';
|
||||||
@ -17,19 +22,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.7.0',
|
'version' => '2.9.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,
|
||||||
'templates' => [
|
OEBasket::class => Basket::class
|
||||||
// GA4 events
|
|
||||||
'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl',
|
|
||||||
'ga4_search.tpl' => 'd3/googleanalytics4/Application/views/ga4/search.tpl',
|
|
||||||
'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl',
|
|
||||||
],
|
],
|
||||||
|
'templates' => [],
|
||||||
'blocks' => [
|
'blocks' => [
|
||||||
// tag manager js
|
// tag manager js
|
||||||
[
|
[
|
||||||
@ -55,12 +57,12 @@ $aModule = [
|
|||||||
[
|
[
|
||||||
'template' => 'page/checkout/basket.tpl',
|
'template' => 'page/checkout/basket.tpl',
|
||||||
'block' => 'checkout_basket_main',
|
'block' => 'checkout_basket_main',
|
||||||
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
'file' => '/Application/views/blocks/view_cart.tpl'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'template' => 'page/checkout/thankyou.tpl',
|
'template' => 'page/checkout/thankyou.tpl',
|
||||||
'block' => 'checkout_thankyou_main',
|
'block' => 'checkout_thankyou_main',
|
||||||
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
'file' => '/Application/views/blocks/purchase.tpl'
|
||||||
],
|
],
|
||||||
// Lists
|
// Lists
|
||||||
// view_item_list
|
// view_item_list
|
||||||
@ -74,7 +76,7 @@ $aModule = [
|
|||||||
[
|
[
|
||||||
'template' => 'page/search/search.tpl',
|
'template' => 'page/search/search.tpl',
|
||||||
'block' => 'search_results',
|
'block' => 'search_results',
|
||||||
'file' => '/Application/views/ga4/search.tpl',
|
'file' => '/Application/views/ga4/view_search_result.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
],
|
],
|
||||||
// add_to_cart
|
// add_to_cart
|
||||||
@ -126,7 +128,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',
|
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST',
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
Loading…
Reference in New Issue
Block a user