|---|---|
| **Select platform:** | [iOS+](https://firebase.google.com/docs/analytics/ios/user-properties.md.txt) [Android](https://firebase.google.com/docs/analytics/android/user-properties.md.txt) [Web](https://firebase.google.com/docs/analytics/web/user-properties.md.txt) [Flutter](https://firebase.google.com/docs/analytics/flutter/user-properties.md.txt) [Unity](https://firebase.google.com/docs/analytics/unity/properties.md.txt) [C++](https://firebase.google.com/docs/analytics/cpp/properties.md.txt) |

<br />

[Video](https://www.youtube.com/watch?v=DletQHfNGCE)

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](https://support.google.com/firebase/answer/6317509)
for your app. This guide shows you how to set user properties in your app.

Analytics automatically logs some
[user properties](https://support.google.com/analytics/answer/9268042);
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 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**

> [!NOTE]
> **Note:** The Age, Gender, and Interests properties are automatically collected only if your app links to the [Ad Support framework](https://developer.apple.com/library/ios/documentation/DeviceInformation/Reference/AdSupport_Framework/index.html). Linking to this framework also automatically collects the Advertising Identifier (IDFA).

### Before you begin

Make sure that you've set up your project and can access Analytics as
described in
[Get Started with Analytics](https://firebase.google.com/docs/analytics/ios/get-started.md.txt).

### Set user properties

You can set Analytics user properties to describe the users of your app.
You can make use of user properties by creating custom definitions, then using
them to apply comparisons in your reports or as audience evaluation criteria.

To set a user property, follow these steps:

1. Create a custom definition for the user property in the Firebase console:

   1. Go to the **Analytics** \>
      [**Custom Definitions** page](https://console.firebase.google.com/project/_/analytics/userproperty).

   2. Create a custom definition for the user property. For more information,
      see
      [Custom dimensions and metrics](https://support.google.com/analytics/answer/10075209).

2. In your app's codebase, set a user property using the
   [`setUserProperty()`](https://firebase.google.com/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics.md.txt#setuserproperty_:forname:)
   method.

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

### Swift


**Note:** This Firebase product is not available on the watchOS target.

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

### Objective-C


**Note:** This Firebase product is not available on the watchOS target.

```objective-c
[FIRAnalytics setUserPropertyString:food forName:@"favorite_food"];
```