0
0
Firebasecloud~10 mins

User properties in Firebase - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - User properties
User opens app
App collects user data
Set user properties
Properties sent to Firebase Analytics
Firebase stores properties
Properties used for analysis and targeting
User properties are labels set by the app to describe users. These are sent to Firebase Analytics to help understand and target users.
Execution Sample
Firebase
firebase.analytics().setUserProperties({
  favorite_food: 'pizza',
  user_level: 'gold'
});
This code sets two user properties: favorite_food and user_level for the current user.
Process Table
StepActionUser Properties StateFirebase Analytics State
1App starts, no user properties set{}{}
2Call setUserProperties with favorite_food='pizza'{"favorite_food":"pizza"}{"favorite_food":"pizza"}
3Call setUserProperties with user_level='gold'{"favorite_food":"pizza", "user_level":"gold"}{"favorite_food":"pizza", "user_level":"gold"}
4User properties sent to Firebase Analytics backend{"favorite_food":"pizza", "user_level":"gold"}{"favorite_food":"pizza", "user_level":"gold"}
5Properties stored and ready for analysis{"favorite_food":"pizza", "user_level":"gold"}{"favorite_food":"pizza", "user_level":"gold"}
💡 User properties are set and synced with Firebase Analytics for use in reports and targeting.
Status Tracker
VariableStartAfter Step 2After Step 3Final
userProperties{}{"favorite_food":"pizza"}{"favorite_food":"pizza", "user_level":"gold"}{"favorite_food":"pizza", "user_level":"gold"}
FirebaseAnalyticsState{}{"favorite_food":"pizza"}{"favorite_food":"pizza", "user_level":"gold"}{"favorite_food":"pizza", "user_level":"gold"}
Key Moments - 3 Insights
Why do user properties appear empty before calling setUserProperties?
Before calling setUserProperties, no properties are set, so the state is empty as shown in step 1 of the execution_table.
Can user properties be updated or overwritten?
Yes, calling setUserProperties again with the same property name updates its value, as shown when user_level is added in step 3.
Are user properties immediately available in Firebase Analytics reports?
Properties are sent and stored after setting, but reports may take some time to reflect changes, as indicated in steps 4 and 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the userProperties state after step 2?
A{"user_level":"gold"}
B{"favorite_food":"pizza"}
C{}
D{"favorite_food":"pizza", "user_level":"gold"}
💡 Hint
Check the 'User Properties State' column in row for step 2.
At which step are both favorite_food and user_level set in Firebase Analytics?
AStep 1
BStep 2
CStep 3
DStep 5
💡 Hint
Look for when both properties appear together in the 'Firebase Analytics State' column.
If you call setUserProperties again with favorite_food='sushi', what happens to userProperties?
Afavorite_food changes to 'sushi', user_level stays 'gold'
BBoth favorite_food and user_level are removed
CNo change to userProperties
Duser_level changes to 'sushi'
💡 Hint
User properties update existing keys when set again, as shown between steps 2 and 3.
Concept Snapshot
User properties label users with key-value pairs.
Set them using setUserProperties in Firebase Analytics.
Properties update or add to existing ones.
Used for user segmentation and analysis.
Changes sync to Firebase backend for reports.
Full Transcript
User properties in Firebase Analytics are labels that describe users with key-value pairs. When the app starts, no properties exist. Calling setUserProperties adds or updates these properties. For example, setting favorite_food to pizza adds that property. Adding user_level as gold adds another property. These properties are sent to Firebase Analytics backend and stored for analysis and targeting. Properties can be updated by calling setUserProperties again with the same keys. Reports may take time to reflect changes. This process helps understand user behavior and personalize experiences.