Hello Olly,
I need to populate a Data Layer (a java script code that sends information to google analytics) with dynamic information such as the order total value, delivery charge, product ID’s etc.
I have searched the templates and browser inspector for the variables that store those information, but couldn’t quite make it work.
Could you tell me what variable I should “echo” in my .js code to output the total value of the order, for example?
—-
For example, in the data layer code below ‘transactionTotal’ is a key with a value of 38.26. Since every transaction has a different value, I need to insert the variable that stores the transactionTotal of the order so it outputs the correct order value to my data layer.
`
window.dataLayer = window.dataLayer || []
dataLayer.push({
‘transactionId’: ‘1234’,
‘transactionAffiliation’: ‘Acme Clothing’,
‘transactionTotal’: 38.26,
‘transactionShipping’: 5,
‘transactionProducts’: [{
‘sku’: ‘DD44’,
‘name’: ‘T-Shirt’,
‘category’: ‘Apparel’,
‘price’: 11.99,
‘quantity’: 1
},{
‘sku’: ‘AA1243544’,
‘name’: ‘Socks’,
‘category’: ‘Apparel’,
‘price’: 9.99,
‘quantity’: 2
}]
});`