Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 30, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

イベントの記録

AWS will end support for Amazon Pinpoint on October 30, 2026,, and is no longer accepting any new users as of May 20 (see the linked doc). The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics.

カスタムイベントの記録

カスタムイベントを記録するには、record APIを呼び出します:

import { record } from 'aws-amplify/analytics';
record({
name: 'albumVisit',
});

分析イベントはメモリにバッファリングされ、定期的にサービスに送信されます。アプリケーションセッション間でローカルに保存されません。バッファリングされたイベントが送信される前にセッションが終了した場合、イベントは失われます。flushEvents APIを使用して、バッファリングされたイベントを手動でサービスに送信してください。

属性付きカスタムイベントの記録

record APIを使用すると、イベントに追加の属性を追加できます。例えば、_albumVisit_イベントと共に_artist_情報を記録するには:

import { record } from 'aws-amplify/analytics';
record({
name: 'albumVisit',
attributes: { genre: '', artist: '' },
});

記録されたイベントはバッファリングされ、定期的にPinpointに送信されます。

エンゲージメントメトリクスの記録

メトリクスをイベントに追加することもできます:

import { record } from 'aws-amplify/analytics';
record({
name: 'albumVisit',
metrics: { minutesListened: 30 },
});

メトリクス値は、floatまたはintegerなどのNumber型である必要があります。

AWS Pinpointのイベント数は、イベント記録後数分で更新されます。

ただし、フィルターセクションにイベントが表示され、Pinpointにカスタム属性が表示されるまでに、30分以上かかる場合があります。

イベントのフラッシュ

記録されたイベントはバッファに保存され、定期的にリモートサーバーに送信されます。必要に応じて、'flushEvents' APIを使用してバッファからすべてのイベントを手動でクリアすることができます。

import { flushEvents } from 'aws-amplify/analytics';
flushEvents();