Hey guys, we are using Zaraz with GA4(e-
Hey guys, we are using Zaraz with GA4(e-commerce tracking enabled).
And we have also follow the instruction of event params. The only problem is that there is no purchase datalayer datas to GA4. Such as the purchase item name, value, etc.
22 Replies
Are you calling the ecommerce tracks from within your site's client side code?
Yes, with the zaraz.ecommerce()
Have you tried looking within the Zaraz debugger to confirm what is being sent?
https://developers.cloudflare.com/zaraz/web-api/ecommerce/#order-completed
The data format confirmed the same as the Order Completed example. And the the event name changed to purchase.
The event name has to be "Order Completed"... Then it's automatically send to GA4 as a "purchase" event server side.
Ty. We will try on that.
After more than 2 weeks testing. Ithe purchase items still not send to GA4. Only Pruchaser count matches.
are you sure the zaraz.ecommerce event looks like this?
<script>zaraz.ecommerce("Order Completed",{"order_id":"141177","affiliation":"Affiliation","total":1.00,"shipping":0.00,"tax":0.17,"discount":0,"currency":"EUR","payment_type":"PT","products":[{"product_id":"xxxxxxx","sku":"xxxxxxx","name":"xxxxxxx","variant":"xxxxxxx","price":1.00,"quantity":1,"currency":"EUR","value":1.00,"position":1}]});</script>
Yes, exactly the same as the example page shows of order complete.
And in the debugger the properties of the Order Complete event are all set with the correct data? Consent is set?

This is the consent mode not passed right?
We've sent this with Debugger enabled.

Indeed... it needs to be R5 instead of P5 (which means no update given or denied).
So you have to look into your consent settings.
You don't have to send the Property EN = Order Completed. Zaraz will push the event to analytics as a 'purchase' event automatically.
If you're using Zaraz' own consent tool then you should add this script to update the consent (after the body tag): (change the cookies with your own)
<script>
document.addEventListener("zarazConsentAPIReady", () => { var strAnalytics = zaraz.consent.get('AnalyticsCookieName') ? 'granted' : 'denied'; var strMarketing = zaraz.consent.get('MarketingCookieName') ? 'granted' : 'denied'; zaraz.set("google_consent_update", { 'ad_storage' : strMarketing, 'ad_user_data' : strMarketing, 'ad_personalization' : strMarketing, 'analytics_storage' : strAnalytics }); }); </script>
document.addEventListener("zarazConsentAPIReady", () => { var strAnalytics = zaraz.consent.get('AnalyticsCookieName') ? 'granted' : 'denied'; var strMarketing = zaraz.consent.get('MarketingCookieName') ? 'granted' : 'denied'; zaraz.set("google_consent_update", { 'ad_storage' : strMarketing, 'ad_user_data' : strMarketing, 'ad_personalization' : strMarketing, 'analytics_storage' : strAnalytics }); }); </script>
Thank you so much. We'll test more.
This is test result without consent mode set. I can see the purchase event. But the purchase item is now shown in GA4. Any sugestions?

I guess without consent the data might not appear in GA4…. I am not sure… I only know that with proper consent it works…
We got this after consent default and update set. The en param is not set by us, we just use zaraz.ecommerce("Order Completed",{}); to send the product and purchase info.
Is that good?

That looks promising…. It needs a couple of days… 👍
I still cannot get the param 'google_consent_default', Did you create an action in Zareaz?

This is the debuging log on Order Complete.

It’s an option in Zaraz (consent) settings ‘enable default consent’… has to be enabled
Yes, these 2 are enabled.
Set Google Consent Mode v2 state ✓
Enable Consent Management ✓
But still no data to Google Analytics, and also the GA4 has passed the consent mode check.

Even there is no debug_mode on the zara debugger. That's wierd.
