Help setting up Google Analytics checkout
Hi… I’m new here…
I’m trying to implement the checkout code for Google Analytics, but really can’t get ir right…
There is this code to send the shopping cart items for Google to start the checkout process:
/**
- Called when the user begins the checkout process.
- @param {Array} cart An array representing the user’s shopping cart.
*/
function checkout(cart) {
for(var i = 0; i < cart.length; i++) {
var product = cart[i];
ga(‘ec:addProduct’, {
‘id’: product.id,
‘name’: product.name,
‘category’: product.category,
‘brand’: product.brand,
‘variant’: product.variant,
‘price’: product.price,
‘quantity’: product.qty
});
}
}
I put this code this way in the app page:
I got this message from Google Tag Assistant:
But the products don’t seem to be added to the checkout list in the Google Analytics…
What is wrong? Any idea/tips?
Thanks a lot…