Amazon Pinpoint
Developer Guide

Reporting Events in Your Application

In your mobile or web application, you can use AWS Mobile SDKs or the Amazon Pinpoint Events API to report usage data, or events, to Amazon Pinpoint. You can report events to capture information such as session times, users' purchasing behavior, sign-in attempts, or any custom event type that you need.

After your application reports events, you can view analytics in the Amazon Pinpoint console. The charts on the Analytics page provide metrics for many aspects of user behavior. For more information, see Chart Reference for Amazon Pinpoint Analytics in the Amazon Pinpoint User Guide.

To analyze and store your event data outside of Amazon Pinpoint, you can configure Amazon Pinpoint to stream the data to Amazon Kinesis. For more information, see Streaming Amazon Pinpoint Events to Kinesis.

By using the AWS Mobile SDKs and the AWS Amplify JavaScript libraries, you can call the Amazon Pinpoint API to report the following types of events:

Session events

Indicate when and how often users open and close your app.

After your application reports session events, use the Analytics page in the Amazon Pinpoint console to view charts for Sessions, Daily active endpoints, 7-day retention rate, and more.

Custom events

Are nonstandard events that you define by assigning a custom event type. You can add custom attributes and metrics to a custom event.

On the Analytics page in the console, the Events tab displays metrics for all custom events that are reported by your app.

Monetization events

Report the revenue that's generated by your application and the number of items that are purchased by users.

On the Analytics page, the Revenue tab displays charts for Revenue, Paying users, Units sold, and more.

Authentication events

Indicate how frequently users authenticate with your application.

On the Analytics page, the Users tab displays charts for Sign-ins, Sign-ups, and Authentication failures.

Before You Begin

If you haven't already, do the following:

Reporting Events with the AWS Mobile SDKs for Android or iOS

You can enable a mobile app to report events to Amazon Pinpoint by using the AWS Mobile SDKs for iOS and Android.

To update your app code to record and submit events, see Add Analytics to your Mobile App with Amazon Pinpoint in the AWS Mobile Developer Guide.

Reporting Authentication Events From a Mobile App

To learn how frequently users authenticate with your app, update your application code so that Amazon Pinpoint receives the following standard event types for authentication:

  • _userauth.sign_in

  • _userauth.sign_up

  • _userauth.auth_fail

You can report authentication events by doing either of the following:

  • Managing user sign-up and sign-in with Amazon Cognito user pools.

  • Reporting authentication events by using the Amazon Pinpoint client that's provided by the AWS Mobile SDK for iOS or Android.

Amazon Cognito user pools are user directories that make it easier to add sign-up and sign-in to your app. As users authenticate with your app, Amazon Cognito reports authentication events to Amazon Pinpoint. For more information, see Using Amazon Pinpoint Analytics with Amazon Cognito User Pools in the Amazon Cognito Developer Guide.

If you don't want to use Amazon Cognito user pools, you can use the Amazon 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.

Android - JavaiOS - SwiftiOS - Objective-C
Android - Java
final AnalyticsEvent event = AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().createEvent("_userauth.sign_in") AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().recordEvent(event); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().submitEvents();
iOS - Swift
let pinpointAnalyticsClient = pinpoint!.analyticsClient let event = pinpointAnalyticsClient.createEventWithEventType("_userauth.sign_in") pinpointAnalyticsClient.recordEvent(event) pinpointAnalyticsClient.submitEvents()
iOS - Objective-C
AWSPinpointEvent *event = _pinpoint.analyticsClient createEventWithEventType :@"_userauth.sign_in"]; _pinpoint.analyticsClient recordEvent:event]; _pinpoint.analyticsClient submitEvents];

Reporting Events with the AWS Amplify JavaScript Library

To record analytics in a JavaScript application, see either of the following topics in the AWS Mobile Developer Guide:

Reporting Events by Using the Amazon Pinpoint API

You can use the Amazon Pinpoint API or an AWS SDK to submit events to Amazon Pinpoint in bulk. For more information, see Events in the Amazon Pinpoint API Reference.

Next Step

You've updated your app to report events. Now when users interact with your app, it sends usage data to Amazon Pinpoint. You can view this data in the console, and you can stream it to Amazon Kinesis.

Next, update your app to handle push notifications that you send with Amazon Pinpoint. See Handling Push Notifications.