简体   繁体   中英

How can you set a user property so that I can track analytics using firebase

I'm looking to try and set a user property of 'staff' to specific users of my app so that I can exclude their data from the firebase analytics.

I have looked into firebase' documentation and from what I understand you can set user properties but to do so it would be by prompting the user to answer a question.

eg.

The following example shows adding a hypothetical favorite food property, which assigns the value in the string food to the active user:

Analytics.setUserProperty(food, forName: "favorite_food")

Is there a way to assign a user property based on their email address, for example if users email address includes '@company.com' then assign a user property of staff to them.

Also I am using React Native.

Thanks!

In order to set a User Property in GA for Firebase you do not need to ask a user to fill a questionnaire.

User Properties are general concept that would let you filter the data on the Analytics report. This filter would provide more insight on the Events that Firebase Analytics logs automatically or the events that you log as custom events.

You can set up a user property that has the domain of the company with the parameter passed. Take a look at this sample code example. One this user property is set in the code, make sure to register it in the Firebase Console. Make sure the key of the user property in the code exactly match the key of the User Property created in Console. Once all is set, the backend will tie the code to the UI user property.

Finally, you can filter the reports based off this user property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM