Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.35 KB

_user-properties.md

File metadata and controls

35 lines (26 loc) · 1.35 KB

{# This content gets published to the following location: #} {# https://firebase.google.com/docs/analytics/user-properties?platform=flutter #}

{# TODO(markarndt): Sync all this content up with Analytics content consolidation plan. #}

Before you begin

Make sure that you've set up your project and can access {{analytics}} as described in Get Started with {{analytics}}.

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 Custom Definitions page{: .external} of {{analytics}} in the {{name_appmanager}}. For more information, see Custom dimensions and metrics.
  2. Set a user property in your app with the setUserProperty() method.

The following example adds a hypothetical favorite food property, which assigns the value in favoriteFood to the active user:

await FirebaseAnalytics.instance
  .setUserProperty({
    name: 'favorite_food',
    value: favoriteFood,
  });