setUserId(null) doesn't seem to work.
Once a user logs in, I send their id. When they log out, I want to reset their userId. Currently I do a setUserId(null), but looking on firebase, events continue being tracked under the previous user id.
Android
Android
0.54.1
4.2.0
@EatSafeClaudia any chance you could provide a code example of your usage, e.g. how you're setting the null and how you're sending events after changing it, are the events immediately after setting to null showing as the old user id and then it changes to null eventually? Or does it consistently always stay on the old user id and never gradually change to null.
Closing due to no response and unable to reproduce locally. Will re-open on request if this is still an issue.
Thanks
Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:
React Native Firebase and Invertase on Twitter @Salakar I'm having this issue aswell. I'm currently running it in a Redux middleware.
I am simply doing firebaseTracker.setUserId(null); where firebaseTracker = firebase.analytics();
When looking in Firebase Debug Mode, I see the following (after running the above function).

I have verified that the function is actually running with a console.warn.
I have tried doing firebaseTracker.setUserId('null');, but that gives me the following:

I mean, it could work.. but I would prefer actually setting it to null.
Platform: Android
RN: 0.55.4
RNFB: 4.2.0
Thanks in advance for your help!
EDIT:
I just noticed I'm also having issues actually setting the user id (not sure how it worked before with 'null'?). When the user logs in, I run the following code:
firebaseTracker.setUserId(id.toString());
firebaseTracker.logEvent('login', { sign_up_method: 'facebook' });
In Firebase I see the 'login' event, but I don't see the actual setting of the user id.
Still having this issue, your description of use, @lukasgjetting, is exactly mine. I am having the issue after upgrade to RN 0.56.0 and RNFB 4.3.8.
I get the same issue - trying to call setUserId(null) or setUserId(undefined) both do not work. I still see the old user id showing up in the Firebase DebugVIew. Only when I call setUserId on another string does the previous one get replaced (eg. setUserId('dummy')
RN version: 0.57.7
RNFB version: tested on both 4.2.0 and 5.2.2 on iOS simulator
@lukasgjetting @EatSafeClaudia @tjjjwxzq not sure what to suggest here, we call the native method directly with the value provided to it from JS, so if you send a null it calls FirebaseAnalytics.getInstance(getContext()).setUserId(null); on Android. This might be a bug with the Firebase Android SDK.
Analytics re-write for v6 is complete and it has some minor changes; all the methods return Promises now so this removes the chance that this could be a race condition (e.g. RN bridge batches method calls, so setting a user id may be being sent along with other method calls, e.g. logEvent at the same time, with a promise now you can ensure that it has set the user before the next analytics method is called).
See https://github.com/invertase/react-native-firebase/blob/master/CHANGELOG.md for details on the v6 release and upgrading notes / caveats - if you wish to try it out early.
This issue is happening on iOS on the following versions:
pod 'Firebase/Core', '5.20.2'
pod 'Fabric', '1.9.0'
pod 'Crashlytics', '3.12.0'
We're able to set the userId, but setting it to nil still retains the old value.
Why has this been closed?
It's still an issue in 5.5.3.
seems to be an underlying sdk issue. I believe the suggested workaround was to set to empty string
can't find the related issue now but it's in the tracker somewhere just not linked here, it was from a separate issue tho
Pretty sure this still exists in v7.
Assuming there is no way to unset this wouldn't setting it to a new UUID each time be better than an empty string so that you don't merge a bunch of users under the "empty" id?
This is more than a year old, if you still have a problem please post a new issue with full details and an App.js that reproduces please