ユーザーの識別
この 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 });}