Page updated Jan 16, 2024

Identify a user

To fully harness the potential of In-App Messaging, you must segment and target your In-App Messaging campaigns to specific user subsets. By identifying users with additional information, including their device demographics, location and any attributes of your choosing, you will be able to display intelligent, targeted in-app messages to the right users.

1const userInfo = {
2 attributes: {
3 // E.g. hobbies: ['cooking', 'knitting'],
4 },
5 demographic: {
6 appVersion: '',
7 locale: '', // E.g. en_US
8 make: '', // E.g. Apple
9 model: '', // E.g. iPhone
10 modelVersion: '', // E.g. 13
11 platform: '', // E.g. iOS
12 platformVersion: '', // E.g. 15
13 timezone: '' // E.g. Americas/Los_Angeles
14 },
15 location: {
16 city: '', // E.g. Seattle
17 country: '', // E.g. US,
18 postalCode: '', // E.g. 98121
19 region: '', // E.g. WA
20 latitude: 0.0,
21 longitude: 0.0
22 },
23 metrics: {
24 // E.g. logins: 157
25 }
26};
27
28await InAppMessaging.identifyUser('some-user-id', userInfo);

Identify a user with Amazon Pinpoint

When using identifyUser with Amazon Pinpoint, you can configure the address and optOut properties in addition to the other user info properties.

1const userInfo = {
2 address: '' // E.g. A device token or email address
3 optOut: '' // Either ALL or NONE
4};
5
6await InAppMessaging.identifyUser('some-user-id', userInfo);