Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Null User Id's recorded by firebase

We are linking our firebase analytics data to BigQuery and upon analyzing found that the user id's are null for several users.

In what scenarios can this happen? and what is the solution for the same.

like image 590
Aashrai Ravooru Avatar asked Feb 07 '23 11:02

Aashrai Ravooru


1 Answers

The bad behavior was when the user_id property was populated with a value. The property user_id should be null except if you set it explicitly with a call to that function:

  • android function: setUserId(...)
  • ios function: setUserId(...)

If you don't explicitly call setUserId, which is common, then the id you should use in BigQuery would be the app_instance_id.

My advice: call setUserId once you have a logged in user (in Facebook, Google sign-in or whatever method you offer). This will give you a cross-device ID. If the user is not logged in, don't call it, and use the app_instance_id id instead.

Note that the app_instance_id change if the user uninstall & reinstall your app.

like image 79
Sistr Avatar answered Feb 13 '23 07:02

Sistr