How to pass promotion views and clicks?

The documentation for zaraz.ecommerce() mentions support for the ‘Clicked Promotion’ and ‘Viewed Promotion’ events. However the data passed to Google Analytics should be like this:

ga('ec:addPromo', {               // Promo details provided in a promoFieldObject.
  'id': 'PROMO_1234',             // Promotion ID. Required (string).
  'name': 'Summer Sale',          // Promotion name (string).
  'creative': 'summer_banner2',   // Creative (string).
  'position': 'banner_slot1'      // Position  (string).
});

But there is no support in the supported parameters for id? Just product_id? Clearly product_id is not it so do I assume I should just pass in ‘id’ and it will work?

Unless someone from Cloudflare wants to chime in, it looks like Promotion ID is not supported. Fortunately, Viewed Promotion does not require a Promotion ID in GA4. Universal Analytics will sunset in July 2023, so you may want to consider migrating to GA4 anyway. That opens another can of worms, though.

Yeah, we are in the process of migrating to GA4 but the first step is to get Zaraz going to make the migration easier :). Hence the reason I am working on this. My goal was to first get GA3 working with Zaraz and the migrate to GA4. I know it’s being sunsetted in like 10 months, but folks are still using it at the moment.

If I cannot get it all working nicely with GA3 then I guess I might need to first migrate to GA4 and then implement Zaraz. But with GA4 there is no history import, so if you want to see any prior history you have to go and see it in your old GA3 properties. So our transition plan is to get GA4 running side by side with GA3 and if I can just send my data to Zaraz and simply activate both GA3 and GA4 it in Zaraz it makes my life a whole lot simpler. Because having both GA3 and GA4 active at the same time is not going to be very easy (stupid GA3 hit callbacks so you do not lose data on page loads).

Totally understand, I’m in the same situation myself. Better to send data to GA4 now than in July 2023!

100%. Just trying to find the best migration plan. Such a PITA.

Hey there,

Promotion id should be available under the name “promotion_id”. For Promotion Clicked, this would give the following zaraz ecommerce call:

zaraz.ecommerce(‘Clicked Promotion’, { promotion_id: ‘PROMO_1234’, name: ‘My Promo name’, creative: ‘My Crea’})

Please feel free to reach out if you face any issue following this implementation.

Kind regards,

Lucas

Great, I will give that a try! Can you update the documentation to reflect this for other users, maybe have an example of how to send a promo click and view?

Ok something else I need help with. How do we pass the list of products for each checkout step via Zaraz to Google Analytics? The Google Enchanced eCommerce page shows you should be passing in the product list with ec:AddProduct which I need to convert to Zaraz:

ga('ec:addProduct', {               // Provide product details in an productFieldObject.
  'id': 'P12345',                   // Product ID (string).
  'name': 'Android Warhol T-Shirt', // Product name (string).
  'category': 'Apparel',            // Product category (string).
  'brand': 'Google',                // Product brand (string).
  'variant': 'black',               // Product variant (string).
  'price': '29.20',                 // Product price (number).
  'quantity': 1                     // Product quantity (number).
});

// Add the step number and additional info about the checkout to the action.
ga('ec:setAction','checkout', {
    'step': 1,
    'option': 'Visa'
});

My assumption is to pass the product list similar to how we pass it to the ‘Product List Viewed’ command which also uses ec:addProduct?

zaraz.ecommerce('Product List Viewed', 
  {  products: 
    [
    { 
      product_id: '999555321',
      sku: '2671033',
      category: 'T-shirts',
      name: 'V-neck T-shirt',
      brand: 'Cool Brand',
      variant: 'White',
      price: 14.99,
      currency: 'usd',
      value: 18.99, 
      position: 1, 
    },{ 
      product_id: '999555322',
      sku: '2671034',
      category: 'T-shirts',
      name: 'T-shirt',
      brand: 'Cool Brand',
      variant: 'Pink',
      price: 10.99,
      currency: 'usd',
      value: 16.99, 
      position: 2, 
    },
    ], 
  }

);

Can someone clarify?