dusanmiha

Enhanced Ecommerce Add to Cart

May 11th, 2020
112
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.addToCart',       // name of an event. In this case, always stays as eec.addToCart
  5.     'ecommerce': {                  // ecommerce object. This is the essential part of tracking. New EE data must always be pushed to this object
  6.         'currencyCode': 'GBP',          // the currency which is currently used by a visitor
  7.         'add': {                        // name of an action. In this case, always stays as add
  8.             'actionField': {           
  9.                 'list': 'main'          // optional. name of a list from which the product was added to a cart  
  10.               },       
  11.             'products': [                   // list of products a user has added to cart
  12.             {                  
  13.                 'name': 'TBD (restaurant - meal name ex DUCK & WAFFLE - CORN RIBS)',      // name of a product that is currently viewed
  14.                 'id': 'TBD (ex 123456)',            // id (SKU) of a product (unique for each product for each of the restaurants)
  15.                 'price': '7.00',            // price of a product (The price of one item. 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.)
  16.                 'brand': 'DUCK & WAFFLE',           // brand/vendor of a product
  17.                 '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)
  18.                 'variant': 'TBD',       // product variant. If there are no variants, exclude this key from the dataLayer.push
  19.                 'quantity' : 1              // product quantity
  20.              }]
  21.         }
  22.     }
  23. });
  24. </script>
RAW Paste Data