Ordering of zaraz.track requests

Hey team! We're using Zaraz to pipe our analytics events from our browser client to GA4. We're calling zaraz.track() and not awaiting the request. We've noticed that if we make this request twice in quick succession, the events often show up in GA in the opposite order to that which they were called. We've done some experimenting and believe that it's simply network latency for these two request resulting in the second request beating the first over the wire and thus ending up pushing to GA in the wrong order. We could await the zaraz.track request on the client to ensure correct ordering, but that would block the UI until Zaraz responds, which we don't want. It would be great if there was a way for Zaraz to order the events based on a client timestamp rather than the time the request was received, is this possible? Or has anyone encountered this issue and have other suggestions? ๐Ÿ™‚ Thanks in advance!
3 Replies
Chaika
Chaikaโ€ข3mo ago
For Zaraz questions, you'd have better luck asking in #zaraz where CF Employees working on Zaraz frequent. They don't watch these public forums, Zaraz is sort of its own little community
miles_blinq
miles_blinqโ€ข3mo ago
Thanks for the suggestion. I actually posted this in #zaraz and didn't get a response so thought I'd try here. I'll bump it in the channel
Chaika
Chaikaโ€ข3mo ago
aw really? might just be the holidays and such, think a lot of people had off Today and Friday. I would help but I do not know the first thing about Zaraz or GA. If you're using the javascript way of using Zaraz though, I imagine you could make your own queue for Zaraz events and await each one without blocking the entire page