Advertisement
emanuel1109

Vitaly - view_item

Sep 7th, 2022 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.dataLayer = window.dataLayer || [];
  2. window.dataLayer.push({
  3.   event: 'view_item',           // name of the event. In this case, it always must be view_item
  4.   ecommerce: {                         
  5.     items: [{                           // an array with a product
  6.       item_name: 'Youthful Brain - Single Unit',            // insert an actual product name
  7.       item_id: 'product1',              // insert an actual product ID/SKU
  8.       price: '11.99',                   // insert an actual product price. Number or a string. Don't include currency code. Insert the price for a single unit (if it's a 3 pack, insert the price for a single unit and change the quantity parameter to the amount of bottles the user purchases, so if it's a 3 pack, then quantity = '3')
  9.       item_category: 'Apparel',         // insert an actual product top-level category like it is on the backend
  10.       item_category2: 'T-shirt',        // if it is possible to drill down the categories (e.g. Apparel, then T-shirt, then Men), use item_category2, item_category3, etc. Can use from item_category up to item_category5
  11.       quantity: '1'                     // product quantity
  12.     },
  13.     {                           // an array with a product
  14.       item_name: 'Youthful Brain - 3 Pack',             // insert an actual product name
  15.       item_id: 'product2',              // insert an actual product ID/SKU
  16.       price: '11.99',                   // insert an actual product price. Number or a string. Don't include currency code. Insert the price for a single unit (if it's a 3 pack, insert the price for a single unit and change the quantity parameter to the amount of bottles the user purchases, so if it's a 3 pack, then quantity = '3')
  17.       item_category: 'Apparel',         // insert an actual product top-level category like it is on the backend
  18.       item_category2: 'T-shirt',        // if it is possible to drill down the categories (e.g. Apparel, then T-shirt, then Men), use item_category2, item_category3, etc. Can use from item_category up to item_category5
  19.       quantity: '1'                     // product quantity.
  20.     },
  21.     {                           // an array with a product
  22.       item_name: 'Youthful Brain - 6 Pack',             // insert an actual product name
  23.       item_id: 'product3',              // insert an actual product ID/SKU
  24.       price: '11.99',                   // insert an actual product price. Number or a string. Don't include currency code. Insert the price for a single unit (if it's a 3 pack, insert the price for a single unit and change the quantity parameter to the amount of bottles the user purchases, so if it's a 3 pack, then quantity = '3')
  25.       item_category: 'Apparel',         // insert an actual product top-level category like it is on the backend
  26.       item_category2: 'T-shirt',        // if it is possible to drill down the categories (e.g. Apparel, then T-shirt, then Men), use item_category2, item_category3, etc. Can use from item_category up to item_category5
  27.       quantity: '1'                     // product quantity
  28.     }]
  29.   }
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement