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
Mackenly
Mackenly2mo ago
Are you calling the ecommerce tracks from within your site's client side code?
Wilson
WilsonOP2mo ago
Yes, with the zaraz.ecommerce()
Mackenly
Mackenly2mo ago
Have you tried looking within the Zaraz debugger to confirm what is being sent?
Wilson
WilsonOP2mo ago
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.
Cloudflare Docs
E-commerce
You can use zaraz.ecommerce() anywhere inside the <body> tag of a page.
BadgeMan
BadgeMan2mo ago
The event name has to be "Order Completed"... Then it's automatically send to GA4 as a "purchase" event server side.
Wilson
WilsonOP4w ago
Ty. We will try on that. After more than 2 weeks testing. Ithe purchase items still not send to GA4. Only Pruchaser count matches.
BadgeMan
BadgeMan4w ago
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>
Wilson
WilsonOP4w ago
Yes, exactly the same as the example page shows of order complete.
BadgeMan
BadgeMan4w ago
And in the debugger the properties of the Order Complete event are all set with the correct data? Consent is set?
No description
Wilson
WilsonOP4w ago
This is the consent mode not passed right?
Wilson
WilsonOP4w ago
We've sent this with Debugger enabled.
No description
BadgeMan
BadgeMan4w ago
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>
Wilson
WilsonOP4w ago
Thank you so much. We'll test more.
Wilson
WilsonOP3w ago
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?
No description
BadgeMan
BadgeMan3w ago
I guess without consent the data might not appear in GA4…. I am not sure… I only know that with proper consent it works…
Wilson
WilsonOP3w ago
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?
No description
BadgeMan
BadgeMan3w ago
That looks promising…. It needs a couple of days… 👍
Wilson
WilsonOP2w ago
I still cannot get the param 'google_consent_default', Did you create an action in Zareaz?
No description
Wilson
WilsonOP2w ago
This is the debuging log on Order Complete.
No description
BadgeMan
BadgeMan2w ago
It’s an option in Zaraz (consent) settings ‘enable default consent’… has to be enabled
Wilson
WilsonOP2w ago
Yes, these 2 are enabled. Set Google Consent Mode v2 stateEnable Consent Management ✓ But still no data to Google Analytics, and also the GA4 has passed the consent mode check.
No description
Wilson
WilsonOP2w ago
Even there is no debug_mode on the zara debugger. That's wierd.
No description

Did you find this page helpful?