GoogleAnalytics4/Application/views/blocks/checkout_s5.tpl

37 lignes
1.7 KiB
Smarty
Brut Vue normale Historique

2023-01-11 15:31:56 +01:00
[{$smarty.block.parent}]
2021-07-17 23:22:23 +02:00
[{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',
2021-07-17 23:22:23 +02:00
'eventLabel':'Checkout Step 5',
'ecommerce': {
'transaction_id': '[{$_gtmOrder->getFieldData("oxordernr")}]',
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
2023-05-12 14:06:21 +02:00
'value': [{$_gtmOrder->getTotalOrderSum()}],
'tax': [{math equation="x+y" x=$_gtmOrder->getFieldData("oxartvatprice1") y=$_gtmOrder->getFieldData("oxartvatprice2") }],
'shipping': [{$_gtmOrder->getFieldData("oxdelcost")}],
2023-01-11 15:31:56 +01:00
'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")}],
2023-01-11 15:31:56 +01:00
'position': [{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
[{/foreach}]
]
2021-07-17 23:22:23 +02:00
}
})
2021-07-17 23:22:23 +02:00
</script>
[{/strip}]