Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.dataLayer = window.dataLayer || [];
- window.dataLayer.push({
- event: 'view_item', // name of the event. In this case, it always must be view_item
- ecommerce: {
- items: [{ // an array with a product
- item_name: 'Youthful Brain - Single Unit', // insert an actual product name
- item_id: 'product1', // insert an actual product ID/SKU
- 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')
- item_category: 'Apparel', // insert an actual product top-level category like it is on the backend
- 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
- quantity: '1' // product quantity
- },
- { // an array with a product
- item_name: 'Youthful Brain - 3 Pack', // insert an actual product name
- item_id: 'product2', // insert an actual product ID/SKU
- 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')
- item_category: 'Apparel', // insert an actual product top-level category like it is on the backend
- 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
- quantity: '1' // product quantity.
- },
- { // an array with a product
- item_name: 'Youthful Brain - 6 Pack', // insert an actual product name
- item_id: 'product3', // insert an actual product ID/SKU
- 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')
- item_category: 'Apparel', // insert an actual product top-level category like it is on the backend
- 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
- quantity: '1' // product quantity
- }]
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement