Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
MaxBUhe | 0ec765955e | |
MaxBUhe | d505d8530a | |
MaxBUhe | fd79710158 | |
MaxBUhe | d2ef663dd3 | |
MaxBUhe | fec30b1109 | |
MaxBUhe | 5c53d83f32 | |
MaxBUhe | 8a7c25fad9 | |
MaxBUhe | 429069e0cf | |
MaxBUhe | 50f9fbca23 | |
MaxBUhe | cb18feba82 | |
MaxBUhe | 47b8622018 | |
MaxBUhe | 92a91d0194 | |
MaxBUhe | 226a80f138 | |
MaxBUhe | 5dd7b51fb5 | |
MaxBUhe | 7b82476e8b | |
MaxBUhe | bfc2ca8ad6 |
|
@ -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}]
|
|
|
@ -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}]
|
|
@ -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}]
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -4,6 +4,19 @@ 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.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
|
||||||
|
|
|
@ -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 {}
|
||||||
}
|
}
|
|
@ -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!";
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
24
metadata.php
24
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.8.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
|
||||||
|
|
Loading…
Reference in New Issue