Skip to content

Commit

Permalink
Updated flush event code snippet to use Analytics Plugin Options (#7472)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhengshs authored May 4, 2024
1 parent 151f083 commit 5a0f606
Showing 1 changed file with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,20 @@ RxAmplify.Analytics.recordEvent(event);

The Amazon Pinpoint event count updates in minutes after recording your event.

However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Pinpoint.
However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Pinpoint.

</Callout>

## Flush events

Events have a default configuration to flush out to the network every 30 seconds. If you would like to change this, update `amplify_outputs.json` with the value in milliseconds you would like for `autoFlushEventsInterval`. This configuration will flush events every 10 seconds:
Events have a default configuration to flush out to the network every 30 seconds. You can change this value by passing the `autoFlushEventsInterval` option to the `AWSPinpointAnalyticsPlugin`. The option value is measured in milliseconds.

```json
{
"analytics": {
"plugins": {
"awsPinpointAnalyticsPlugin": {
"pinpointAnalytics": {
"appId": "<your-app-id>",
"region": "<your-app-region>",
"autoFlushEventsInterval": 10000
},
"pinpointTargeting": {
"region": "<your-app-region>"
}
}
}
}
```kotlin
val options = AWSPinpointAnalyticsPlugin.Options {
autoFlushEventsInterval = 60_000
}
Amplify.addPlugin(AWSPinpointAnalyticsPlugin(options))
Amplify.configure(AmplifyOutputs(R.raw.amplify_outputs), this)
```

To manually flush events, call:
Expand Down Expand Up @@ -173,7 +162,7 @@ You can report authentication events by doing either of the following:
- Manually recording events using the `recordEvent()` API.

If you don't want to use Cognito user pools, you can use the Pinpoint client to record and submit authentication events, as shown in the following examples. In these examples, the event type is set to `_userauth.sign_in`, but you can substitute any authentication event type.

<BlockSwitcher>
<Block name="Java">

Expand Down Expand Up @@ -310,7 +299,7 @@ Future<void> recordCustomEvent() async {

The Amazon Pinpoint event count updates in minutes after recording your event.

However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Amazon Pinpoint.
However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Amazon Pinpoint.

</Callout>

Expand Down

0 comments on commit 5a0f606

Please sign in to comment.