filipr27

GA4 - purchase - ofmpec

Apr 28th, 2022 (edited)
177
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',
  4.   reorder: 'true',  // Varaible value. 'true' - if the order is a reorder, 'false' - if the order is not a reorder.
  5.   ecommerce: {
  6.     currency: 'USD',                           //Required. Transaction Currency - Type: string
  7.     value: 13243.80,                           //Transaction Revenue  - Type: number
  8.     tax: 996.09,                               //Transaction Tax - Type: number
  9.     shipping: 0.00,                            //Transaction Shipping - Type: number
  10.     transaction_id: 'abc123',                  //Required. Transaction ID - Type: string
  11.     coupon: 'coupon',                          //The coupon name/code associated with the event - Type: string
  12.     items: [{
  13.       item_name: 'REDA ESP - Gas Handler',             //Product Name - Type: string
  14.       item_id: 'Reda-Esp-Gas-Handler',                 //Product ID/SKU - Type: string
  15.       price: 11130.00,                                 //Product price - Type: number
  16.       currency: 'USD',                                 //Currency of the price that is collected - Type: string
  17.       discount: 0.00,                                  //Any discount associated with this product - Type: number
  18.       affiliation: 'sals',                             //Vendor - Type: string
  19.       item_brand: 'schlumberger',                      //Product Brand - Type: string  
  20.       item_category: 'Production',                     //Product Category - Type: string
  21.       item_category2: 'Electrical Submersible Pumps',  //Product Sub-Category 1 - Type: string
  22.       item_category3: 'REDA ESP - Gas Handler',                //Product Sub-Category 2 - Type: string
  23.       item_category4: 'Gas Volume Fraction 75%',                //Product Sub-Category 3 - Type: string
  24.       item_category5: 'item_category5',                //Product Sub-Category 4 - Type: string
  25.       item_variant: '102761535',                       //Variant of the product - variant SKU/ID - Type: string
  26.       quantity: 1                                      //Product quantity - Type: number
  27.     },{
  28.       item_name: 'Tiger Bullets',             //Product Name - Type: string
  29.       item_id: 'Tiger-Bullets-Lcm',                 //Product ID/SKU - Type: string
  30.       price: 2113.80,                                 //Product price - Type: number
  31.       currency: 'USD',                                 //Currency of the price that is collected - Type: string
  32.       discount: 0.00,                                  //Any discount associated with this product - Type: number
  33.       affiliation: 'miswaco',                             //Vendor - Type: string
  34.       item_brand: 'federal',                      //Product Brand - Type: string  
  35.       item_category: 'Drilling',                     //Product Category - Type: string
  36.       item_category2: 'Fluids',                    //Product Sub-Category 1 - Type: string
  37.       item_category3: 'Tiger Bullets',                //Product Sub-Category 2 - Type: string
  38.       item_category4: 'Units - 60',                //Product Sub-Category 3 - Type: string
  39.       item_category5: 'Pickup - Monahans, TX',                //Product Sub-Category 4 - Type: string
  40.       item_variant: 'M0017771-60-3',                       //Variant of the product - variant SKU/ID - Type: string
  41.       quantity: 1                                      //Product quantity - Type: number
  42.     }]
  43.   }
  44. });
Add Comment
Please, Sign In to add comment