User Analytics with AWS Amplify and Pinpoint
Enabling real-time user actions
Building and maintaining user-centric applications rely on accurate and reliable user metrics and analytics. As the applications evolve, scaling and keeping the loop between the analytics data and the product decisions strong becomes challenging. In this article, we will walk through a sample application and how we use AWS Amplify and Pinpoint to place mechanisms to get deep insights into the user journeys and take “real-time” actions based on user interactions to achieve a solid closed loop.
Application
We are building a simple application that lets users create and send “appreciation” posts, create groups, join groups, and share posts in the groups. We will then track and collect user interaction from the app.
Technology Choices
We will use AWS Amplify to bootstrap the app to get started quickly. Amplify pulls together core services into a cohesive story for developers. It handles bootstrapping, resource and permission configuration, and UI component generation. In addition, you can evolve the app with deep customer insights by adding components and interaction tracking, user analytics with AWS Pinpoint, or custom analytics with AWS Kinesis. Here, we will be using AWS Pinpoint for user events and journeys.
Data Model
We will start with the data model of the app. At this stage, thinking about entities and relations and query and mutation patterns is essential. In our model, the entities are what we expect the user to create, and relations are for constraints and grouping required for these entities.
Note that Amplify will create the UI components from the model and the backend with API, data and sync layers. We do not need to write any additional backend code. It is easy to enable offline-first scenarios, cloud sync with AppSync and GraphQL, authentication, etc with Amplify libraries.
A user journey and client-side tracking
For our app, one crucial metric is the “number of appreciation posts.” We would be interested in cases where the user intends to “submit” the post but instead cancels it. Based on some additional criteria, when this happens, we can send an in-app notification or email with some pointers or inspiration to increase the chances of submissions next time.
To track this, we will enable Page Event Tracking (with the user’s consent) and add annotations to the UI component, AppreciationCreateForm (generated by Amplify as per the data model above), to send events to Pinpoint.
In the code below, the event “appreciationCreateForm” signals entry to the journey, while appreciationCreateFormCanceled or appreciationCreateFormSubmitted signals one of the user's different paths.
For the user journey, we also need to update the Pinpoint endpoint to assign users to the corresponding segment based on their actions in the UI. For our use case, they are either in the AppreciationCardSubmitted or AppreciationCardCancelled segment based on the custom endpoint attribute set from the application.
User Funnel and Journey
Now that our app emits the events, we can gather insights and set up actions at Pinpoint Console.
First, let’s look at the funnel. By adding the events, we can see only 10% of submissions after the user opens the form.
Let’s set up a user journey to detect this “abandoned” path and email the user with further instructions to help them complete it. In the example below, the user enters the journey with an event. Then, depending on which segment they are at after a delay (here in the test journey, the condition is evaluated immediately), they will get an email or exit the journey. The email aims to help users complete the journey with links to the documentation or examples.
Note that here we are using the email action to improve the outcomes of this journey, but in reality you would be running a user experience research to understand better and potentially implement UI improvements in combination with emails or other actions.
Recap
In this article, we showed how to leverage AWS Amplify and Pinpoint to gain initial insights into user interactions in an application and implement actions to improve outcomes with user journeys.