Search code examples
eventsgoogle-analyticstimestamp

(Google Analytics 4). Collect custom events sorted by "event_timestamp"


I have a custom event created directly on the web page, as follows:

gtag('event', <action>, {'value': <value>, 'event_timestamp': Date.now()});

Google Analytics 4 is recording them and I can see them in the reports. My problem is that the timestamp of the events has a precision of 1 second and sometimes, when two events occur in a row within the same second, GA4 records them with the same timestamp, and sometimes interleaves them in the timeline, putting the first one after the second one and breaking the sequence order. It is very important to maintain the order of events in the Google Analytics 4 User Interface. That's why the object 'event_timestamp': Date.now() has been added in gtag(), to get an accuracy of milliseconds. Now, is it possible to sort the events in GA4's UI according to 'event_timestamp'? Regards and thanks.

NOTE: I don't use Google Tag Manager or BigQuery.


Solution

  • The solution to the problem is to mark the event as conversion; that way GA4 receives the events immediately after they are generated on the web and they are perfectly ordered. Regards.