Advertisement
metricLabs

GTM - eCommerce dataLayer

Oct 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <script>
  2. dataLayer.push({
  3. 'event': 'transaction',
  4. 'ecommerce': {
  5. 'purchase': {
  6. 'actionField': {
  7. 'id': 'T12345', // Transaction ID. Required
  8. 'affiliation': 'Online Store',
  9. 'revenue': '35.43', // Total transaction value (incl. tax and shipping)
  10. 'tax':'4.90',
  11. 'shipping': '5.99',
  12. 'coupon': 'SUMMER_SALE'
  13. },
  14. 'products': [{ // List of productFieldObjects.
  15. 'name': 'T-Shirt 2', // Name or ID is required.
  16. 'id': '12345',
  17. 'price': '15.25',
  18. 'brand': 'Metric Labs',
  19. 'category': 'Shirts',
  20. 'variant': 'Gray',
  21. 'quantity': 1,
  22. 'coupon': '' // Optional fields may be omitted or set to empty string.
  23. },
  24. {
  25. 'name': 'T-Shirt 1',
  26. 'id': '67890',
  27. 'price': '33.75',
  28. 'brand': 'Metric Labs',
  29. 'category': 'Shirts',
  30. 'variant': 'Black',
  31. 'quantity': 1
  32. }] //expand this array if more product exists
  33. }
  34. }
  35. });
  36.  
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement