0
0
Firebasecloud~5 mins

User properties in Firebase - Commands & Configuration

Choose your learning style9 modes available
Introduction
User properties let you describe your app users with simple labels. This helps you understand who your users are and how they behave.
When you want to group users by age or location to see how different groups use your app.
When you want to track if users are premium subscribers or free users.
When you want to personalize app content based on user interests.
When you want to filter analytics reports to focus on specific user segments.
When you want to create marketing campaigns targeting users with certain traits.
Commands
This command sets user properties 'age' and 'subscription' for the user with ID 'user123'. It helps label the user for analytics.
Terminal
firebase analytics set-user-properties --user-id user123 --properties "age=25,subscription=premium"
Expected OutputExpected
User properties set for user ID user123
--user-id - Specifies the user ID to assign properties to
--properties - Defines the key-value pairs of user properties
This command retrieves the user properties for the user with ID 'user123' to verify what labels are set.
Terminal
firebase analytics get-user-properties --user-id user123
Expected OutputExpected
age: 25 subscription: premium
--user-id - Specifies the user ID to fetch properties for
Key Concept

If you remember nothing else from this pattern, remember: user properties are simple labels that help you understand and segment your app users.

Common Mistakes
Trying to set user properties without specifying the user ID
The system does not know which user to label, so the command fails or has no effect.
Always include the --user-id flag with the correct user identifier.
Using invalid characters or spaces in property keys or values
User properties must be simple strings without spaces or special characters, otherwise they are rejected.
Use only letters, numbers, and underscores in keys and values without spaces.
Summary
Use the firebase analytics CLI to set user properties with --user-id and --properties flags.
Verify user properties by retrieving them with the get-user-properties command.
User properties help label users for better analytics and targeted actions.