Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Feb 21, 2024

Identify user

Amplify Flutter v1 is now in Maintenance Mode until April 30th, 2025. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Flutter to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

This call sends information that you have specified about a user to Amazon Pinpoint. This could be for an unauthenticated (guest) or an authenticated user.

You can get the current user's ID from the Amplify Auth category as shown per the Auth category documentation. Be sure to have it ready before you set it as shown below (Check out the Authentication Getting Started guide for detailed explanation).

If you have asked for location access and received permission, you can also provide that in UserProfileLocation

Future<void> addAnalyticsWithLocation({
required String userId,
required String name,
required String email,
required String phoneNumber,
required int age,
}) async {
final userProfile = UserProfile(
name: name,
email: email,
location: const UserProfileLocation(
latitude: 47.606209,
longitude: -122.332069,
postalCode: '98122',
city: 'Seattle',
region: 'WA',
country: 'USA',
),
customProperties: CustomProperties()
..addStringProperty('phoneNumber', phoneNumber)
..addIntProperty('age', age),
);
await Amplify.Analytics.identifyUser(
userId: userId,
userProfile: userProfile,
);
}

Sending user information allows you to associate a user to their user profile and activities or actions in your app. The user's actions and attributes can also tracked across devices and platforms by using the same userId.

Some scenarios for identifying a user and their associated app activities are:

  • When a user completes app sign up
  • When a user completes sign in process
  • When a user launches your app
  • When a user modifies or updates their user profile