Set User Properties

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

Analytics automatically logs some user properties; you don't need to add any code to enable them. If your app needs to collect additional data, you can set up to 25 different Analytics user properties in your app.

Before you begin

If this is your first time adding Analytics to your app, complete the following procedures:

Connect your app in the Firebase console

  1. Install the Firebase SDK for C++.
  2. In the Firebase console, add your app to your Firebase project.

Add Analytics to your app

In order to use the Analytics libraries in your C++ project, you'll need to add it to your build files, so that the appropriate libraries are linked.


  1. Add the Firebase Java Component to the build.gradle file:

    implementation ''

  2. Link the following libraries when you build your C++ component:



Before you can build for iOS, you'll need to add the Firebase frameworks to your Xcode project:

  1. Add the following dependancy to your Podfile:
    pod 'Firebase/Core'
    pod 'Firebase/Analytics'
  2. Run $pod install
  3. Add firebase.framework and firebase_analytics.framework to your xcode project.

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 Analytics tab of the Firebase console.

  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 mFavoriteFood to the active user:

SetUserProperty("favorite_food", mFavoriteFood);

You can access this data as follows:

  1. In the Firebase console, open your project.
  2. Select Analytics from the menu to view the Analytics reporting dashboard.

The User Properties tab 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 for Firebase. Read more about the Analytics reporting dashboard in the Firebase Help Center.

Şunun hakkında geri bildirim gönderin...

Yardım mı gerekiyor? Destek sayfamızı ziyaret edin.