amplitude / amplitude/Amplitude-Android

Events logged in close succession sometimes get logged in the wrong order.

Aperta
#152 8 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
169
Fork
87
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Setup
Android, `implementation 'com.amplitude:android-sdk:2.15.0'` in `build.gradle`
Two activities:`FirstActivity` and `SecondActivity`.
`FirstActivity` has a button that opens `SecondActivity`

Thee events:
* `FirstActivity opened` logged in `FirstActivity.onCreate()`
* `FirstActivity button pressed` logged in `OnClickListener.OnClick()` that is set to the button in `FirstActivity`
* `SecondActivity opened` logged in `SecondActivity.onCreate()`

### What is wrong
On https://analytics.amplitude.com `SecondActivity opened` sometimes appears before `FirstActivity button pressed`.
Example:
screen shot 2017-11-02 at 09 31 38
This complicates funnel analysis on funnels that depend on the order of events.

Setting `enableLogging(true).setLogLevel(Log.VERBOSE)` shows these events being logged in correct order
```
11-02 02:51:31.253 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: FirstActivity opened
11-02 02:51:35.477 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: FirstActivity button pressed
11-02 02:51:35.541 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: SecondActivity opened
```
On the website these events have
`"client_event_time"` and `"event_id"` values indicate correct order.
`"_time"` and `"event_time"` values indicate incorrect order.

Increasing the time between events by logging in `onResume()` instead of `onCreate()` does not help.

I will publish an [MCVE](https://stackoverflow.com/help/mcve) shortly.

### Edit
MCVE is [here](https://github.com/makaroffandrey/Amplitude_issue_152_MCVE)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.