miles_blinq
CDCloudflare Developers
•Created by miles_blinq on 4/2/2024 in #general-help
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!
4 replies