Zaraz and GA4 e-commerce tracking

Hi,

I am starting to onboard my clients to Cloudflare on a large scale and I am using the built-in Zaraz apps for GA4. However, I am encountering a problem and I am asking for your help. In Zaraz, I have enabled the “e-commerce” modules, but they do not transform the datalayer into the required format as per the documentation zaraz.ecommerce('Event Name', { parameters });.

image

Should I manually configure all events and their parameters in that case? When I manually set the parameter values by pulling them from the datalayer through “event: Property”, everything works. I am just wondering if this is the correct way to configure it?

The GA4 configuration via Variable Event Property > Trigger (event_name) > Zaraz GA4 works fine, but is this how I should be doing it? I am in dire need of help as my clients are getting impatient.

It’s unclear to me what you’re doing. You’re mentioning zaraz.ecommerce(), but also writing about the dataLayer. The two are completely unrelated and incompatible.

To send e-commerce events from Zaraz you need to:
1 - Enable e-commerce tracking in the tool settings (like in your screenshot)
2 - Enable e-commerce tracking in the Zaraz settings
3 - Make zaraz.ecommerce() calls in your website code whenever it is suitable, like the docs explain.

You do not need to:

  • Do anything with dataLayer
  • Configure any triggers or actions

Thanks for your replay. The case is that I can’t make zaraz.ecommerce() calls. I try do something with datalayer with I have - that’s why I configure triggers and actions.

1 Like

I don’t know what you mean by “can’t make zaraz.ecommerce() calls”, but note that Zaraz does not support for sending e-commerce data using the datalayer.

I can’t interfere with the store’s source code. I thought that this Cloudflare “e-commerce option” would transform the data from datalayer to e-commerce by itself. If not, everything is clear.

Yoav, I have one more question for you.
I add triggers and actions manually, everything works fine - except passing the “Array” information about the product. How can I add them?

This is how I do it now:

  • I add a “custom field” named items.0.item_name etc.
  • with the value from the variable “items.0.name” etc. but it doesn’t work.


Others like value or transaction_id etc. they work great.
Thanks in advance for your help

You cannot in any simple way. The only supported way to send ecommerce data with Zaraz is using zaraz.ecomerce()

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.