Last active
January 5, 2020 09:11
-
-
Save kaesetoast/adcf967a31d5f9a7a2814f17e62e0a72 to your computer and use it in GitHub Desktop.
DataLayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The dataLayer JavaScript is generated inside of a smarty template. All variables in curly-braces have to be replaced | |
// with whatever your system provides you with. | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
dataLayer.push({ | |
event: "orderCompleted", | |
transactionId: '{$sOrderNumber}', // Transaction ID. Required for purchases and refunds. | |
transactionTotal: {if $sAmountWithTax && $sUserData.additional.charge_vat}{$sAmountWithTax}{else}{$sAmount}{/if}, // Total transaction value (incl. tax and shipping) | |
transactionTax: {$sAmountTax}, | |
transactionShipping: {$sShippingcosts}, | |
transactionProducts: [ | |
{foreach $sBasket.content as $key => $sBasketItem} | |
{ | |
sku: "{$sBasketItem.ordernumber}", | |
name: "{$sBasketItem.articlename}", // Name or ID is required | |
price: {$sBasketItem.priceNumeric}, | |
quantity: {$sBasketItem.quantity} | |
}, | |
{/foreach} | |
] | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment