Amazon Pinpoint
Developer Guide

Reporting Events

You can use the AWS Mobile SDK for Android to report app usage data, or events, to Amazon Pinpoint. Report events to capture information such as app session times, users' purchasing behavior, sign-in attempts, or any custom event type that serves your needs.

After your app reports events, view app 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.

Recording Monetization Events

To track the revenue that is generated by your app and the number of items purchased by users, update your app code to report monetization events.

After your app reports monetization events, view revenue analytics in the Amazon Pinpoint console. On the Analytics page, the Revenue tab provides charts for Revenue, Paying users, Units sold, and more.

The following example uses the AnalyticsClient of the PinpointManager class to record and submit a monetization event.

final AnalyticsEvent event = GooglePlayMonetizationEventBuilder.create(AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient()) .withCurrency("USD") .withItemPrice(1.00) .withProductId("PRODUCT_ID") .withQuantity(1.0) .withTransactionId("TRANSACTION_ID").build(); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().recordEvent(event); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().submitEvents();

Reporting Authentication Events

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

  • _userauth.sign_in

  • _userauth.sign_up

  • _userauth.auth_fail

After Amazon Pinpoint receives these event types, use the Analytics page in the Amazon Pinpoint console to view charts for Sign-ins, Sign-ups, and Authentication failures.

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

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

  • Submitting events with the PinpointManager class.

Amazon Cognito user pools provide 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 AnalyticsClient of the PinpointManager class to record and submit authentication events, as shown in the following example. The event type is set to _userauth.sign_in, but you can substitute any authentication event type.

final AnalyticsEvent event = AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().createEvent("_userauth.sign_in") AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().recordEvent(event); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().submitEvents();

Reporting Custom Events

A custom event must have an event type, and you can add custom attributes and metrics to that event.

In the following example, the AWSMobileClient class is provided in the AWS Mobile Hub sample code to reference the Amazon Pinpoint object.

final AnalyticsEvent event = AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().createEvent("MyCustomEvent") // A music app use case might include attributes such as: // .withAttribute("Playlist", "Amazing Songs 2016") // .withAttribute("Artist", "Various") // .withMetric("Song playtime", playTime); .withAttribute("MyAttribute1", "MyAttributeValue1") .withAttribute("MyAttribute2", "MyAttributeValue2") .withMetric("MyMetric1", Math.random()); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().recordEvent(event); AWSMobileClient.defaultMobileClient() .getPinpointManager().getAnalyticsClient().submitEvents();