9
Views
2
Comments
[Analytics Plugin (Firebase)] How to set null for setUserId ?
analytics-plugin-firebase
Mobile icon
Forge asset by OutSystems
Application Type
Mobile

Hi,

It seems there is no way in this plugin to set the user id as null whenever the user logout from the app, while passing setUserId(null) via javascript is not working as it is been translated to "null" in firebase GA4 console., I used the below code to set null from javascript , can you please support ?


cordova.plugins.firebase.analytics.setUserId(null);

2025-01-10 11-40-52
Pedro Gustavo Bilro

Hey @Bassam Basamad, I believe this currently isn't supported by the plugin.


Can you try this option listed as a solution here - https://www.outsystems.com/forums/discussion/102839/how-to-clear-a-firebase-user-property/#Post451308

2021-02-01 08-40-39
Bassam Basamad

Using firebase.analytics().setUserProperty('user_id', null); in the OutSystems Firebase Analytics plugin will not effectively clear or set the user ID to null in the same way that setUserId(null) would.

Here's why:

setUserProperty vs. setUserId: setUserProperty is designed to set custom user properties (key-value pairs), while setUserId is specifically for setting the primary user identifier in Firebase Analytics. While "user_id" can be a custom user property, it is distinct from the dedicated user ID tracked by setUserId.Intended Behavior of setUserId(null): The official Firebase documentation and related discussions indicate that setUserId(null) is the correct method to clear or unset the user ID in Firebase Analytics.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.