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

Page updated Mar 26, 2026

イベントを記録する

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.

イベントを記録する

Amplify Analyticsプラグインを使用すると、アプリ内でカスタムイベントを簡単に記録できます。プラグインはデバイスがネットワーク接続を失った場合の再試行ロジックを処理し、リクエストを自動的にバッチ処理してネットワーク帯域幅を削減します。

AnalyticsEvent event = AnalyticsEvent.builder()
.name("PasswordReset")
.addProperty("Channel", "SMS")
.addProperty("Successful", true)
.addProperty("ProcessDuration", 792)
.addProperty("UserAge", 120.3)
.build();
Amplify.Analytics.recordEvent(event);
val event = AnalyticsEvent.builder()
.name("PasswordReset")
.addProperty("Channel", "SMS")
.addProperty("Successful", true)
.addProperty("ProcessDuration", 792)
.addProperty("UserAge", 120.3)
.build()
Amplify.Analytics.recordEvent(event)
AnalyticsEvent event = AnalyticsEvent.builder()
.name("PasswordReset")
.addProperty("Channel", "SMS")
.addProperty("Successful", true)
.addProperty("ProcessDuration", 792)
.addProperty("UserAge", 120.3)
.build();
RxAmplify.Analytics.recordEvent(event);

Amazon Pinpointのイベント数は、イベントを記録してから数分以内に更新されます。

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

イベントをフラッシュする

イベントはデフォルトで30秒ごとにネットワークにフラッシュされるように設定されています。この値は、AWSPinpointAnalyticsPluginautoFlushEventsIntervalオプションを渡すことで変更できます。オプション値はミリ秒で測定されます。

val options = AWSPinpointAnalyticsPlugin.Options {
autoFlushEventsInterval = 60_000
}
Amplify.addPlugin(AWSPinpointAnalyticsPlugin(options))
Amplify.configure(AmplifyOutputs(R.raw.amplify_outputs), this)

イベントを手動でフラッシュするには、以下を呼び出します:

Amplify.Analytics.flushEvents();
Amplify.Analytics.flushEvents()
RxAmplify.Analytics.flushEvents();

イベントをフラッシュするとき、Pinpointサービスに正常に送信されたイベントを含むHubイベントが送信されます。これらのイベントのリストを受け取るには、HubChannel.ANALYTICSチャネルを購読し、AnalyticsChannelEventName.FLUSH_EVENTSタイプのイベントを処理します。

グローバルプロパティ

グローバルプロパティを登録して、Amplify.Analytics.recordEventのすべての呼び出しで送信できます。

Amplify.Analytics.registerGlobalProperties(
AnalyticsProperties.builder()
.add("AppStyle", "DarkMode")
.build());
Amplify.Analytics.registerGlobalProperties(
AnalyticsProperties.builder()
.add("AppStyle", "DarkMode")
.build())
RxAmplify.Analytics.registerGlobalProperties(
AnalyticsProperties.builder()
.add("AppStyle", "DarkMode")
.build());

グローバルプロパティの登録を解除するには、Amplify.Analytics.unregisterGlobalProperties()を呼び出します:

Amplify.Analytics.unregisterGlobalProperties("AppStyle", "OtherProperty");
Amplify.Analytics.unregisterGlobalProperties("AppStyle", "OtherProperty")
RxAmplify.Analytics.unregisterGlobalProperties("AppStyle", "OtherProperty");