Advertisement
Jawad_Khan

EEC- GA4 - purchase - Shopcast

Apr 6th, 2023
598
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: 'purchase',            // name of the event. In this case, it always must be purchase
  4.   ecommerce: {
  5.     currency: 'PKR',
  6.     value: 29.98,                       // order total (price of all products + shipping)
  7.     tax: 3.00,                          // tax
  8.     shipping: 5.00,                 // shipping costs
  9.     transaction_id: 'abc123',           // transaction id
  10.     coupon: 'ENDOFSUMMER',          // if coupon was applied to the order, include it here         
  11.     items: [{                           // an array with all products
  12.       item_name: 'Product 1',           // insert an actual product name
  13.       item_id: 'product1',              // insert an actual product ID
  14.       price: 11.99,                 // insert an actual product price. Number or a string. Don't include currency code
  15.       item_brand: 'brand A',            // insert an actual product price
  16.       item_category: 'Apparel',         // insert an actual product top-level category
  17.      
  18.       quantity: '1',                    // product quantity
  19.       item_coupon: 'SUMMER20'           // if a coupon was applied not to the entire order but to one product, use item_coupon
  20.         item_app: 'Shopcast'            //if a product that appears is from the recommended products then Shopcast should appear here otherwise it should be emply
  21.         item_model:'user_to_item'       //if the product is from the recommended products then the respective model should come here i.e. user_to_item, item_to_item or top_rated
  22.     },{
  23.       item_name: 'Product 2',
  24.       item_id: 'product2',
  25.       price: 12.99,
  26.       item_brand: 'Brand B',
  27.       item_category: 'Category B',
  28.       item_variant: 'Yellow',
  29.       quantity: '1'
  30.         item_app: 'Shopcast'                //if a product that appears is from the recommended products then Shopcast should appear here otherwise it should be empty
  31.  
  32. item_model:'user_to_item'       //if the product is from the recommended products then the respective model should come here i.e. user_to_item, item_to_item or top_rated
  33.  
  34.     }]
  35.   }
  36. });
  37.     }]
  38.   }
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement