jaspacio

GA UA Purchase

Dec 16th, 2020 (edited)
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. window.dataLayer  = window.dataLayer || [];
  3. window.dataLayer.push({
  4.     'event': 'purchase',                // name of an event. In this case, always stays as purchase
  5.     'ecommerce': {                          // ecommerce object. This is the essential part of tracking. New EE data must always be pushed to this object
  6.         'purchase': {                       // name of an action. In this case, always stays as purchase
  7.             'actionField': {
  8.                 'id': '155',                // order id. required
  9.                 'affiliation': 'affiliate', // name of the affiliate. or affiliate id (not applicable)
  10.                 'revenue': '50.00',         // order revenue without taxes
  11.                 'tax':'12.00',              // taxes (excluding shipping)
  12.                 'shipping': '12.00',        // shipping cost
  13.                 'coupon': 'SUMMER20'        // coupon or promo code used in this transaction
  14.             },
  15.             'products': [{                  // list of products a user has purchased
  16.                 'name': 'Citizen - SUPER TITANIUM. MODEL: AW0060-11P',      // name of a product that is currently viewed
  17.                 'id': 'CIT30283',           // id of a product
  18.                 'price': '330.00',          // price of a product
  19.                 'brand': 'Citizen',         // brand/vendor of a product
  20.                 'category': 'Watches',      // category of a product
  21.                 'variant': 'Silver',        // product variant. If there are no variants, exclude this key from the dataLayer.push
  22.                 'quantity' : 1              // product quantity
  23.              }]
  24.         }  
  25.   }
  26. });
  27. </script>
Add Comment
Please, Sign In to add comment