Skip to content

Instantly share code, notes, and snippets.

@marcusRB
Created June 30, 2018 14:42
Show Gist options
  • Save marcusRB/cb9b9bddddaceaff57b6f4a9b6342cb2 to your computer and use it in GitHub Desktop.
Save marcusRB/cb9b9bddddaceaff57b6f4a9b6342cb2 to your computer and use it in GitHub Desktop.
Adding a Product to a Shopping Cart EEC dataLayer
// Measure adding a product to a shopping cart by using an 'add' actionFieldObject
// and a list of productFieldObjects.
dataLayer.push({
'event': 'addToCart',
'ecommerce': {
'currencyCode': 'EUR',
'add': { // 'add' actionFieldObject measures.
'products': [{ // adding a product to a shopping cart.
'name': 'Triblend Android T-Shirt',
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1
}]
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment