dusanmiha

Enhanced Ecommerce Purchase

May 7th, 2020
170
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': 'eec.purchase',                // name of an event. In this case, always stays as eec.purchase
  5.     'ecommerce': {                          // ecommerce object. This is the essential part of tracking. New EE data must always be pushed to this object
  6.         'currencyCode': 'GBP',              // currency code used on a website
  7.         'purchase': {                       // name of an action. In this case, always stays as purchase
  8.             'actionField': {
  9.                 'id': 'Order123',                // order id. required (The unique order ID of the transaction. Should match the actual ID of the order)
  10.                 'affiliation': 'affiliate', // name of the affiliate. or affiliate id
  11.                 'revenue': '102.00',         // order revenue without taxes (The value must not include anything else except number separated by a decimal point. Don't use a comma as the separator, and don't include any currency symbols)
  12.                 'tax':'TBD',                // taxes (excluding shipping) (Tax paid. Same formatting instructions as with revenue.)
  13.                 'shipping': '7',        // shipping cost (Cost of shipping (Delivery). Same formatting instructions as with revenue.)
  14.                 'coupon': 'TBD'         // coupon code used in this transaction
  15.             },
  16.             'products': [                   // list of products a user has purchased
  17.             {                  
  18.                 'name': '{{restaurant - meal name ex DUCK & WAFFLE - CORN RIBS}}',      // name of a product that is currently viewed. Upsell products - product name
  19.                 'id': 'TBD (ex 123456)',            // id (SKU) of a product (unique for each product for each of the restaurants)
  20.                 'price': '7.00',            // price of a product (The price of one item. Same formatting instructions as with revenue.)
  21.                 'brand': 'DUCK & WAFFLE',           // brand/vendor of a product
  22.                 'category': 'DUCK & WAFFLE/DUCK & WAFFLE',      // Product category of the item. Can have maximum five levels of hierarchy. restaurant/sub-menu-category (ex. clothes/shirts/t-shirts)
  23.                 'variant': '{{PRODUCT VARIANT ex Homeslice}}',      // product variant. If there are no variants, exclude this key from the dataLayer.push
  24.                 'quantity' : 1              // product quantity
  25.              },
  26.             {  
  27.                 'name': 'TBD (restaurant - meal name ex DUCK & WAFFLE - BACON WRAPPED DATES | Two per order)',      // name of a product that is currently viewed
  28.                 'id': 'TBD (ex 123457)',            // id (SKU) of a product (unique for each product for each of the restaurants)
  29.                 'price': '10.00',           // price of a product (The price of one item. Same formatting instructions as with revenue.)
  30.                 'brand': 'DUCK & WAFFLE',           // brand/vendor of a product
  31.                 'category': 'DUCK & WAFFLE',        // category of a product within restaurant menu
  32.                 'variant': 'TBD',       // product variant. If there are no variants, exclude this key from the dataLayer.push
  33.                 'quantity' : 2              // product quantity
  34.              },
  35.             {  
  36.                 'name': 'TBD (restaurant - meal name ex DUCK & WAFFLE - CRISPY YELLOWTAIL TAQUITOS | Two per order)',      // name of a product that is currently viewed
  37.                 'id': 'TBD (ex 123458)',            // id (SKU) of a product (unique for each product for each of the restaurants)
  38.                 'price': '15.00',           // price of a product (The price of one item. Same formatting instructions as with revenue.)
  39.                 'brand': 'DUCK & WAFFLE',           // brand/vendor of a product
  40.                 'category': 'SUSHISAMBA SMALL PLATES',      // Product category of the item. Can have maximum five levels of hierarchy. restaurant/sub-menu-category (ex. clothes/shirts/t-shirts)
  41.                 'variant': 'TBD',       // product variant. If there are no variants, exclude this key from the dataLayer.push
  42.                 'quantity' : 5              // product quantity
  43.              }]
  44.         }  
  45.   }
  46. });
  47. </script>
Add Comment
Please, Sign In to add comment