Set user properties

User properties are attributes you define to describe segments of your userbase, such as language preference or geographic location.

Analytics automatically logs someuser properties;you don't need to add any code to enable them. If your app needs to collectadditional data, you can set up to 25 differentAnalytics user propertiesin your app.

Before you begin

Make sure that you've set up your project and can accessAnalytics asdescribed inGet Started withAnalytics for C++.

Set user properties

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

Set a user property as follows:

  1. Register the property in theAnalytics tabof theFirebase console.

  2. Add code to set anAnalytics user property with theSetUserProperty() method. You can use the name andvalue of your choosing for each property.

The following example shows adding a hypothetical favorite food property, whichassigns the value in the stringmFavoriteFood to the active user:

SetUserProperty("favorite_food",mFavoriteFood);
Note: Once the property is registered, it can take several hours for datacollected with the property to be included in reports. When the new data isavailable, the user property can be used as a report filter.

You can access this data as follows:

  1. In theFirebase console, open your project.
  2. SelectAnalytics from the menu to view theAnalyticsreporting dashboard.

TheUser Properties tab shows a list of user properties that you havedefined for your app. You can use these properties as a filter on many of thereports available inGoogle Analytics. Read more about theAnalytics reporting dashboard in the Firebase Help Center.

Note: Data in theAnalytics reporting dashboard refreshes periodicallythroughout the day.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.