GoogleAnalytics4/Application/views/blocks/checkout_s5.tpl

38 lignes
1.8 KiB
Smarty
Brut Vue normale Historique

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': {
'purchase': {
'actionField': {
'id':'[{$_gtmOrder->oxorder__oxordernr->value}]',
'affiliation':'[{$oxcmp_shop->oxshops__oxname->value}]',
'revenue':'[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
'tax':'[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
2022-12-20 11:52:25 +01:00
'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]',
'currency': "[{$_gtmOrder->getFieldData('oxcurrency')}]"
2021-07-17 23:22:23 +02:00
},
'products':[
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
{
'id':'[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]',
'variant':'[{$_gtmArticle->oxorderarticles__oxselvariant->value}]',
'price': [{$_gtmArticle->oxorderarticles__oxprice->value}],
'quantity':[{$_gtmArticle->oxorderarticles__oxamount->value}],
'position':[{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
[{/foreach}]
]
}
}
});
</script>
[{/strip}]
[{$smarty.block.parent}]