I've been trying to figure this out..I think data layer.push is simply updating the second amount. Could someone explain what is exactly going on here?
function dollarz() {
var amount1 = '$156.86';
var amount2 = amount1.replace("$","");
return amount2;
}
dataLayer.push({
'transactionTotalNoDollar': dollarz(),
'event': 'sendUpdateTwo'
});
dataLayer is presumably an array, and push
adds an additional element to the end of the array.
The object that gets pushed has two properties: one is the static 'event': 'sendUpdateTwo'
. The other property transactionTotalNoDollar
gets its value from the result of calling dollarz
. dollarz
returns `'156.86', so the object that gets pushed looks like:
{
'transactionTotalNoDollar': '156.86',
'event': 'sendUpdateTwo'
}