Advertisement
Guest User

Untitled

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