genuine reworking structure and aligning all

This commit is contained in:
MaxBUhe 2023-01-11 15:25:02 +01:00
parent c83e908da1
commit 664119f89e
2 changed files with 32 additions and 36 deletions

View File

@ -8,16 +8,14 @@
'event': 'purchase', 'event': 'purchase',
'eventLabel':'Checkout Step 5', 'eventLabel':'Checkout Step 5',
'ecommerce': { 'ecommerce': {
'purchase': { 'transaction_id':'[{$_gtmOrder->oxorder__oxordernr->value}]',
'actionField': {
'id':'[{$_gtmOrder->oxorder__oxordernr->value}]',
'affiliation':'[{$oxcmp_shop->oxshops__oxname->value}]', 'affiliation':'[{$oxcmp_shop->oxshops__oxname->value}]',
'revenue':'[{$_gtmOrder->oxorder__oxtotalordersum->value}]', 'value':'[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
'tax':'[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]', 'tax':'[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]', 'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]',
'currency': "[{$_gtmOrder->getFieldData('oxcurrency')}]" 'currency': "[{$_gtmOrder->getFieldData('oxcurrency')}]"
}, 'items':
'products':[ [
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}] [{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
{ {
'id':'[{$_gtmArticle->oxorderarticles__oxartnum->value}]', 'id':'[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
@ -31,7 +29,7 @@
] ]
} }
} }
}); })
</script> </script>
[{/strip}] [{/strip}]
[{$smarty.block.parent}] [{$smarty.block.parent}]

View File

@ -2,26 +2,24 @@
[{assign var="gtmProduct" value=$oView->getProduct()}] [{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}] [{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}] [{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{strip}][{/strip}]
<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',
'ecommerce': { 'ecommerce': {
'currencyCode': '[{$currency->name}]', 'currency': '[{$currency->name}]',
'detail': { 'items': [
'products': [
{ {
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]', 'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]', 'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}], 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]', 'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]' 'price': [{$gtmProduct->oxarticles__oxprice->value}]
} }
] ]
} }
}
}); });
</script> </script>