I want to put this code sample on the page after successful purchase of product(s), well, how to do that and where to find that file by Cyber Dick (WebDAV)
Please help, here is a sample of the code:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'purchase-gtm',
'ecommerce': {
'purchase': {
'actionField': {
'id': '{{checkout.order.id}}', // order number
'revenue': '{{checkout.order.total.value}}', // total transaction value (incl. tax and shipping)
'tax':'{{ecommerce.tax}}',
'shipping': '{{ecommerce.shipping}}'
},
'products': [
{{#each checkout.order.items}}
{
'name': '{{name}}', //Product Name
'id': '{{product_id}}', //Product ID
'price': '{{price.value}}', //Product Price
'brand': '{{brand.name}}', //Product Brand
'category': '{{category}}', //Product Category
'quantity': '{{quantity}}',
'variant': '{{sku}}', //Product variant if applicable
},
{{/each}}
],
}
}
});
</script>