Skip to content

Instantly share code, notes, and snippets.

@marcusRB
Created June 30, 2018 14:38
Show Gist options
  • Save marcusRB/af4280d43ba372ee5ff2cd6035c7054c to your computer and use it in GitHub Desktop.
Save marcusRB/af4280d43ba372ee5ff2cd6035c7054c to your computer and use it in GitHub Desktop.
Measuring Views of Product Details EEC dataLayer
<script>
// Measure a view of product details. This example assumes the detail view occurs on pageload,
// and also tracks a standard pageview of the details page.
dataLayer.push({
'ecommerce': {
'detail': {
'actionField': {'list': 'Apparel Gallery'}, // 'detail' actions have an optional list property.
'products': [{
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray'
}]
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment