Identify user
This call sends information that you have specified about the user to Amazon Pinpoint. This could be an authenticated user. If the user is signed in through Amplify.Auth.signIn, then you can retrieve the current user and use it with Analytics. You can also provide location information in AnalyticsUserProfile.Location
.
func identifyUser() {
guard let user = Amplify.Auth.getCurrentUser() else { print("Could not get user, perhaps the user is not signed in") return }
let location = AnalyticsUserProfile.Location(latitude: 47.606209, longitude: -122.332069, postalCode: "98122", city: "Seattle", region: "WA", country: "USA")
let properties: AnalyticsProperties = ["phoneNumber": "+11234567890", "age": 25]
let userProfile = AnalyticsUserProfile(name: username, email: "name@example.com", location: location, properties: properties)
Amplify.Analytics.identifyUser(user.userId, withProfile: userProfile)
}