ユーザーの識別
この API は、現在のユーザーに関する情報を Amazon Pinpoint に送信します。
ユーザー名、メール、位置情報、デバイスなどの追加情報は、UserProfile を指定することで含めることができます。カスタム属性は UserProfile.customProperties を設定することで含めることもできます。
ユーザーが signIn を通じてサインインした場合、以下に示すように現在のユーザーの ID を取得できます:
import { identifyUser } from 'aws-amplify/analytics';import { getCurrentUser } from 'aws-amplify/auth';
const location = { latitude: 47.606209, longitude: -122.332069, postalCode: '98122', city: 'Seattle', region: 'WA', country: 'USA'};
const customProperties = { plan: ['plan'], phoneNumber: ['+11234567890'], age: ['25']};
const userProfile = { location, name: 'username', email: 'name@example.com', customProperties};
async function sendUserData() { const user = await getCurrentUser();
identifyUser({ userId: user.userId, 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