Solved

Events ordering (browser + server)

  • 29 April 2022
  • 2 replies
  • 193 views

Badge

Hello Amplitude community!

 

We are developing web app where we use Ampitude JS (front) + Amplitude Java SDK’s (server).

In our web app there is a registration flow with the following events:

  1. REGISTRATION_STARTED (browser)
  2. PHONE_ENTERED (browser)
  3. PHONE_SENT (browser)
  4. PHONE_CHECKED (server)
  5. SMS_SENT (server) - sms code sent to client mobile phone
  6. SMS_SENT (browser) - user enters sms code in the input and send it
  7. SMS_VALIDATED (server)
  8. REGISTRATION_SUCCEED (browser)

 

Problem: in Amplitude analytics events: 4 and 5 some times are displayed after event 8 because browser and server times are a bit different. These wrong ordering makes our funnel charts show wrong statistics.

How can we set strict event ordering as described before?

icon

Best answer by eddie.gaona 30 April 2022, 01:17

View original

2 replies

Userlevel 5
Badge +9

Hello @DALLAS,

 

To my understanding, events are being ingested in a different order than expected which is affecting your Funnel views.

 

Within the SDKs you can actually control the event time to order the events.

Here is the documentation for the JS SDK.

The Java SDK is newer but here is an example on how you can set the time parameter:

In java, the Event is a class, it allowed you to set the properties.
The example:

Event event = new Event("Test Event", "test_user_id");
event.timestamp = 123;

amplitude.logEvent(event);

In this way you have control with the order of the events.

Badge

Thank you for the answer, but is there is any other variant?

Reply