Check out what’s new from Firebase at Google I/O 2022. Learn more

Set User Properties

User properties are attributes you define to describe segments of your user base, such as language preference or geographic location. These can be used to define audiences for your app. This guide shows you how to set user properties in your app.

Analytics automatically logs some user properties; you don't need to add any code to enable them. If you need to collect additional data, you can set up to 25 different Analytics User Properties per project. Note that user property names are case-sensitive and that setting two user properties whose names differ only in case results in two distinct user properties being logged.

You can't use a small set of user property names reserved by Google:

  • Age
  • Gender
  • Interest

Before you begin

Make sure that you've set up your project and can access Analytics as described in Get Started with Analytics.

Set user properties

You can set Analytics user properties to describe the users of your app. You can analyze behaviors of various user segments by applying these properties as filters to your reports.

Set a user property as follows:

  1. Register the property in the User Properties page of Analytics in the Firebase console. For more information, see Set and register a user property.
  2. Add code to set an Analytics user property with the setUserProperty() method. You can use the name and value of your choosing for each property.

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


Note: This Firebase product is not available on the macOS target.
Analytics.setUserProperty(food, forName: "favorite_food")


Note: This Firebase product is not available on the macOS target.
[FIRAnalytics setUserPropertyString:food forName:@"favorite_food"];

You can access this data from the User Properties dashboard in the Firebase console. This dashboard shows a list of user properties that you have defined for your app. You can use these properties as a filter on many of the reports available in Google Analytics. Read more about the Analytics reporting dashboard in the Firebase Help Center.