winord

purchase event data layer

Feb 18th, 2019
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. window.dataLayer = window.dataLayer || [];
  3. dataLayer.push({
  4.   'ecommerce': {
  5.     'event': 'eePurchaseEvent',
  6.     'purchase': {
  7.       'actionField': {
  8.         'id': 'T12345',                         // #Musthave Transaction ID= OrderId. Required for purchases and refunds.
  9.         'revenue': '35.43',                     // #Musthave Total transaction value (incl. tax and shipping)
  10.         'tax':'4.90',                           //#Nicetohave
  11.         'shipping': '5.99',                     //#Nicetohave
  12.         'coupon': 'SUMMER_SALE',                //#Musthave
  13.         'option': 'Domestic Card'    // payment method //#Musthave
  14.       },
  15.       'products': [{                            // List of productFieldObjects. Create a for loop for an order containing many products
  16.         'name': 'Triblend Android T-Shirt',     //#Musthave Name or ID is required.
  17.         'id': '12345',                          //#Nicetohave
  18.         'price': '15.25',                       //#Musthave
  19.         'brand': 'Google',                      //#Nicetohave
  20.         'category': 'Apparel',                  //#Musthave
  21.         'variant': 'Gray',                      //#Nicetohave
  22.         'quantity': 1,                          //#Nicetohave
  23.         'coupon': 'product_coupon'              //#Musthave  
  24.        },
  25.        {
  26.         'name': 'Donut Friday Scented T-Shirt',
  27.         'id': '67890',                          //#Nicetohave
  28.         'price': '33.75',                       //#Musthave
  29.         'brand': 'Google',                      //#Nicetohave
  30.         'category': 'Apparel',                   //#Musthave
  31.         'variant': 'Black',                     //#Nicetohave
  32.         'quantity': 1                           //#Nicetohave
  33.          'coupon': 'product_coupon'             //#Musthave
  34.        }]
  35.     }
  36.   }
  37. });
  38. </script>
  39. </script>
Advertisement
Add Comment
Please, Sign In to add comment