GoogleAnalytics4/copy_this/modules/bla/tag-manager/application/views/blocks/ee/s5_thankyou.tpl

43 lines
2.1 KiB
Smarty

<script>
[{*
dataLayer.push({
'event': 'ee.checkout',
'eventLabel':'Checkout 5',
'ecommerce': {'checkout': {'actionField': {'step': 5}}}
});
*}]
[{assign var="_gtmOrder" value=$oView->getOrder()}]
[{assign var="_gtmBasket" value=$oView->getBasket()}]
[{assign var="_gtmArticles" value=$_gtmBasket->getBasketArticles()}]
dataLayer.push({
'event': 'ee.transaction',
'eventLabel':'[{oxmultilang ident="ORDER_COMPLETED"}]',
'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 }]',
'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]'
/*'coupon':'CANO25' //if a coupon code was used for this order*/
},
'products':[
[{foreach key="_index" from=$_gtmBasket->getContents() item="_gtmBasketitem" name="gtmTransactionProducts"}]
{
'id':'[{$_gtmArticles[$_index]->oxarticles__oxartnum->value}]',
'name': '[{$_gtmArticles[$_index]->oxarticles__oxtitle->value}]',
'variant':'[{$_gtmArticles[$_index]->oxarticles__oxvarselect->value}]',
'price': '[{$_gtmBasketitem->getFTotalPrice()|replace:",":"."}]',
'item_price': '[{$_gtmBasketitem->getFTotalPrice()|replace:",":"."}]',
'quantity':[{$_gtmBasketitem->getAmount()}],
'position':[{$smarty.foreach.gtmTransactionProducts.index}]
}[{if !$smarty.foreach.gtmTransactionProducts.last}],[{/if}]
[{/foreach}]
]
}
}
});
</script>
[{$smarty.block.parent}]