Keen + Sendgrid: Guide to Long-Term Email Data Storage and Email Marketing Dashboards

Tracking email metrics is a great way to measure the success of any email campaigns you run and helps monitor the health of your email channel as a whole. Take your metrics to the next level by leveraging our Keen + Sendgrid integration to create flexible and customizable email marketing dashboards that you can show to internal stakeholders and clients.

SendGrid is an email infrastructure platform that lets you easily send transactional and marketing emails. Together with SendGrid we built an integration that allows you to receive all events that happen within an email, such as: Delivered, Opens, Clicks, Marked as Spam and lots more!

It only takes a couple of minutes to start streaming email event data from SendGrid to Keen, and once you do, we offer permanent storage for your email data and you can create flexible email analytics dashboards.

This guide covers:

  • Send Your SendGrid Data to Keen
  • Test Your Integration
  • Embedding SendGrid Analytics Into Your App
  • Additional Resources

Send your SendGrid Data to Keen

Step 1: Create a Keen and SendGrid account, if you don’t have them yet.

You can create your free Keen account here. Once you’ve created your account, you’ll want to create a new project in the Keen UI for your SendGrid Email Event Data. Make sure to copy your Project ID and API Write Key from the Access tab because you’ll need these later.

Then, navigate to your SendGrid account (Don’t have an account? You can create one here.)

Step 2: Configure Keen + SendGrid Integration

After logging into your SendGrid account, click on Settings from the left menu → Select Mail Settings. Then click on “Event Webhook”.

Step 3: Set the HTTP POST URL (example below) as the endpoint where SendGrid will stream all of your email data.

Copy and paste the above URL into the HTTP POST URL field in Sendgrid. Make sure to replace YOUR_KEEN_PROJECT_ID and YOUR_KEEN_API_WRITE_KEY with your Project ID and API Write Key available in the Access tab (copied from before). Set Authorization Method to “None”.

In the settings, select the events you want to post to Keen (why not all of them?). To do this, check “All” under the “Select Actions.” You can check out SendGrid’s event documentation for more information on these events.

That’s it! Now, as your emails make their way through SendGrid, all of the event information will be posted to Keen. A new Event Collection, aptly named for each type of email event, will be created within your Keen Project.

Test Your Integration

Test that everything is working by clicking on the “Test Your Integration” button in SendGrid’s “Event Webhook” Settings. This will send sample email data from SendGrid into your Keen Project. In the Keen UI, check the Streams tab for sample SendGrid data.

Enable the Event Webhook and your SendGrid email data should now be sent to Keen.

Your Data: SendGrid Data Models

Under SendGrid Mail Settings → Event Webhook, each email event type that is selected will be recorded as a separate Event Collection in your Keen project. We recommend selecting “All” to access full functionality of the app’s reporting.

The email events that are recorded are:

  • email_bounce
  • email_click
  • email_deferred
  • email_delivered
  • email_dropped
  • email_group_resubscribe
  • email_group_unsubscribe
  • email_open
  • email_processed
  • email_spamreport
  • email_unsubscribe

As SendGrid email data streams to Keen, we’ll enhance it using our Data Enrichment capabilities. Our enrichments turn IP addresses into geographic location and break out timestamps, URLs, and user agent strings into more easy-to-use data like “device type”, “day_of_the_week”, and URL “path”.

To explore all of the email data you have at your fingertips, log into your Keen account, select your Project with your SendGrid data, and open the “Streams” tab. In the search bar type in “email” to check out your data collections associated with SendGrid email data.

Pro Tips: Use the property message_id or singlesend_name contained in each event to track a particular email across all of these possible actions. Similarly, you can follow a particular users’ behavior via the email property.

How to Use the Data Explorer

Keen’s Data Explorer can help you run queries on your Sendgrid event data, allowing you to compare events against different variables, and even allows the creation of flexible Marketing Dashboards.

We’ve created an article on 8 Marketing Metrics to track in 2020, and then whipped up a tutorial on how to build a dashboard in Keen using those same metrics! Nifty, we know.

Embedding SendGrid Analytics Into Your App

With Keen, you will have access to all of your raw data for as long as you need it. An archive of all of your email data is created, which means you will have access to your historical data and can query for past user behavior.

Just like SendGrid, Keen is 100% powered by APIs. This means you can embed rich analytics anywhere you can write code.

Many customers find it useful to embed analytics into their products for their customers or customer success teams. You’re able to get a shareable link from the Dashboard Creator, or if you have a developer resource on your team, they can easily follow our step-by-step Customer-Facing Analytics Guide to embed Sendgrid analytics into your application. Some customers also take advantage of Keen’s S3 Streaming capabilities to write a copy of all their data to AWS.

Additional Resources:

  • SendGrid’s complete Event Webhooks Documentation is a great resource on SendGrid email events. As you start to do more analysis, it’s worth a read. You can even skip a lot of the sections because we’ve done much of the work for you.
  • Build a campaign and email marketing dashboard. Create and display your email metrics using one of our dashboard templates.