ovipreneur

Purchase Datalayer-beds and drinks

Dec 10th, 2020 (edited)
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //room name, transacion id and price, revenue, quanity data should be addedd. ask developer to make this code dynamic//
  2.  
  3. //this code need to be addded in the confirmation page//
  4.  
  5. <script>
  6. window.dataLayer  = window.dataLayer || [];
  7. window.dataLayer.push({
  8.     'event': 'eec.purchase',                // name of an event. In this case, always stays as eec.purchase
  9.     'ecommerce': {                          // ecommerce object. This is the essential part of tracking. New EE data must always be pushed to this object
  10.         'purchase': {                       // name of an action. In this case, always stays as purchase
  11.             'actionField': {
  12.                 'id': '155',                // transaction id. required
  13.                 'affiliation': 'affiliate', // name of the affiliate. or affiliate id
  14.                 'revenue': '50.00',         // order revenue without taxes
  15.                 'coupon': 'cuponcode'       // coupon code used in this transaction
  16.             },
  17.             'products': [{                  // list of rooms a user has purchased
  18.                 'name': 'Private 8-bed Room',      // name of a room that is currently viewed
  19.                 'price': '330.00',          // price of a room
  20.                 'category': 'private',      // category of a room//private, shared etc//
  21.                 'quantity' : 1              // room quantity
  22.              }]
  23.         }  
  24.   }
  25. });
  26. </script>
Add Comment
Please, Sign In to add comment