AWS Messaging & Targeting Blog
Creating custom Pinpoint dashboards using Amazon QuickSight, part 2
Note: This post was written by Manan Nayar and Aprajita Arora, Software Development Engineers on the AWS Digital User Engagement team.
In our previous post, we discussed the process of visualizing specific, pre-aggregated Amazon Pinpoint metrics—such as delivery rate or open rate—using the Amazon Pinpoint Metrics APIs. In that example, we showed how to create a Lambda function that retrieves your metrics, and then make those metrics available for creating visualizations in Amazon QuickSight.
This post discusses shows a different approach to exporting data from Amazon Pinpoint and using it to build visualizations. Rather than retrieve specific metrics, you can use the event stream feature in Amazon Pinpoint to export raw event data. You can use this data in Amazon QuickSight to create in-depth analyses of your data, as opposed to visualizing pre-calculated metrics. As an added benefit, when you use this solution, you don’t have to modify any code, and the underlying data is updated every few minutes.
Step 1: Configure the event stream in Amazon Pinpoint
The Amazon Pinpoint event stream includes information about campaign events (such as campaign.send
) and application events (such as session.start
). It also includes response information related to all of the emails and SMS messages that you send from your Amazon Pinpoint project, regardless of whether they were sent from campaigns or on a transactional basis. When you enable event streams, Amazon Pinpoint automatically sends this data to your S3 bucket (via Amazon Kinesis Data Firehose) every few minutes.
To set up the event stream
- Sign in to the Amazon Pinpoint console at http://console.thinkwithwp.com/pinpoint. In the list of projects, choose the project that you want to enable event streaming for.
- Under Settings, choose Event stream.
- Choose Edit, and then configure the event stream to use Amazon Kinesis Data Firehose. If you don’t already have a Kinesis Data Firehose stream, follow the link to create one in the Kinesis console. Configure the stream to send data to an S3 bucket. For more information about creating streams, see Creating an Amazon Kinesis Data Firehose Delivery Stream.
- Under IAM role, choose Automatically create a role. Choose Save.
Step 2: Add a data set in Amazon QuickSight
Now that you’ve started streaming your Amazon Pinpoint data to S3, you can set Amazon QuickSight to look for data in the S3 bucket. You connect QuickSight to sources of data by creating data sets.
To create a data set
-
- In a text editor, create a new file. Paste the following code:
{ "fileLocations": [ { "URIPrefixes": [ "s3://<bucketName>/" ] } ], "globalUploadSettings": { "format": "JSON" } }
In the preceding code, replace <bucketName> with the name of the S3 bucket that you’re using to store the event stream data. Save the file as manifest.json.
- Sign in to the QuickSight console at https://quicksight.thinkwithwp.com.
- Create a new S3 data set. When prompted, choose the manifest file that you created in step 1. For more information about creating S3 data sets, see Creating a Data Set Using Amazon S3 Files in the Amazon QuickSight User Guide.
- Create a new analysis. From here, you can start creating visualizations of your data. To learn more, see Creating an Analysis in the Amazon QuickSight User Guide.
- In a text editor, create a new file. Paste the following code:
Step 3: Set the refresh rate for the data set
You can configure your data sets in Amazon QuickSight to automatically refresh on a certain schedule. In this section, you configure the data set to refresh every day, one minute before midnight.
To set the refresh schedule
- Go to the QuickSight start page at https://quicksight.thinkwithwp.com/sn/start. Choose Manage data.
- Choose the data set that you created in the previous section.
- Choose Schedule refresh. Follow the prompts to set up a daily refresh schedule.
Step 4: Create your visualizations
From this point, you can start creating visualizations of your data. To learn more about creating visualizations, see Creating an Analysis in the Amazon QuickSight User Guide.