Sometimes some of my events do not get logged in the Firebase DebugView and I'm currently trying to find out why.
We decided about leaving out the await
for firebase.analytics().logEvent(...)
, and now I wonder if that could lead to the missing events. In my understanding this should not make a difference in the behavior, because I don't have to wait for the event to be logged.
So my question is: Does it make a difference in reliability of the event logging in the following two cases?
// With await
await firebase.analytics().logEvent('event_name');
// Without await
firebase.analytics().logEvent('event_name');
Thank you!
firebase.analytics().*
gives u a promise which you need to handle. Under the hood the methods call the firebase app which optimizes communications to Firebase GA servers. You can enable logs
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
and watch them with
adb logcat -v time -s FA FA-SVC
Update 2023-05-23:
More generic question "do we need to await async calls?" is answered here Does an async function always need to be called with await?