Need to configure your backend?See Build a Backend →
ユーザーの識別
このAPIは、現在のユーザーに関する情報をAmazon Pinpointに送信します。
UserProfileを指定することで、ユーザーの名前、メール、位置情報、デバイスなどの追加情報を含めることができます。UserProfile.customPropertiesを設定することで、カスタム属性も含めることができます。
ユーザーがsignInを通じてサインインした場合、以下に示すように現在のユーザーのIDを取得できます:
src/index.js
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 });}ユーザー情報を送信することで、ユーザーをそのユーザープロフィールとアプリ内のアクティビティまたはアクションに関連付けることができます。ユーザーのアクション属性は、同じuserIdを使用することで、デバイスとプラットフォーム全体で追跡することもできます。
ユーザーを識別し、関連するアプリアクティビティを識別するシナリオの例は以下の通りです:
- ユーザーがアプリのサインアップを完了した場合
- ユーザーがサインインプロセスを完了した場合
- ユーザーがアプリを起動した場合
- ユーザーがユーザープロフィールを変更または更新した場合