Skip to main content

Update app user metadata

Once you have registered your app user, you can attach a map with key-value pairs which contain additional data about the app user and their behavior.

Update app user metadata by calling the Shake.updateUserMetadata method anywhere in your code after registering the app User. a

Special keys

Values from these three keys will be presented nicely on the Shake dashboard, so we suggest you use them:

  • first_name
  • last_name

Updates

Updates to the app user metadata are merged. This allows you to update user metadata in segments from various parts of your app, even when offline.

A common approach developers take is updating generic app user metadata from one place in your code upon every app user change

main.dart
void onLoggedIn(User user) {
var metadata = <String, String>{
'first_name': user.getFirstName(),
'last_name': user.getLastName(),
'email': user.getEmail(),
'status': user.getStatus()
};
Shake.updateUserMetadata(metadata);
}

and updating specific app user metadata in their respective contexts:

main.dart
void onUserSettingsConfigured(UserSettings userSettings) {
fetchUserInformation();
var metadata = <String, String> {
'userSettings': userSettings.toString()
};
Shake.updateUserMetadata(metadata);
}

Limitations

The total map size of the app user metadata must not exceed 50 KB. If this validation fails, the update method is dropped with the appropriate console message.

App user metadata vs. Ticket metadata

Track app User metadata to understand and describe your app User better. Examples are:

  • First and last name
  • App user ID
  • Address
  • Subscription status
  • Date of birth

Use Ticket metadata to attach useful custom data to each ticket. Examples are statuses of various app variables at the moment the ticket is sent:

  • Current chat room ID
  • List of items currently in a shopping cart
  • Task synced true/false
  • Number of search results
  • List sorted by what
  • Video muted true/false