dusanmiha

GA4 - purchase

Oct 6th, 2021 (edited)
1,067
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.   ecommerce: {
  5.     currency: 'RSD',                            //Required. Transaction Currency - Type: Numeric
  6.     value: 10920,                               //Transaction Revenue  - Type: Numeric
  7.     tax: 7.18,                                  //Transaction Tax - Type: Numeric
  8.     shipping: 10.00,                            //Transaction Shipping - Type: Numeric
  9.     affiliation: 'My Parka Store',              //Optional. Transaction Affiliation -  - Type: string
  10.     transaction_id: 'p115-20202000',            //Required. Transaction ID - Type: String
  11.     coupon: '20%off',                   //Coupon Code of applicable - Type: String
  12.     items: [{
  13.       item_name: 'Product 1',                    //Product Name - Type: string
  14.       item_id: 'mp1122',                        //Product ID/SKU - Type: string
  15.       price: '31.10',                           //Product price - Type: numeric
  16.       item_brand: 'product brand',              //Product Brand- Type: string  
  17.       item_category: 'Apparel',                 //Product Category - Type: string
  18.       item_category2: 'Coats',                  //Product Sub-Category 1 - Type: string
  19.       item_category3: 'Wool',                   //Product Sub-Category 2 - Type: string
  20.       item_category4: 'Unisex',                 //Product Sub-Category 3 - Type: string
  21.       item_category5: 'cat5',                 //Product Sub-Category 4 - Type: string
  22.       item_variant: 'Navy blue',                //Variant of other product like size, color et c - Type: string
  23.       quantity: '3'                             //Product quantity - Type: integer
  24.     },{
  25.       item_name: 'stain removal',
  26.       item_id: 'psr1332',
  27.       price: '5.99',
  28.       item_brand: 'product brand',
  29.       item_category: 'Apparel',
  30.       item_category2: 'Utility',
  31.       item_category3: 'Care product',
  32.       item_category4: 'Unisex',            
  33.       item_category5:'cat5',
  34.       quantity: '1'
  35.     }]
  36.   }
  37. });
Add Comment
Please, Sign In to add comment