How to Track Email Opens, Clicks, and Bounces Using AWS SES, SNS, and CloudWatch
Getting your system metrics visible is key so that you can respond quickly. Let's see how you can track actions from your email notifications such as opens, clicks, and bounces.
Join the DZone community and get the full member experience.Join For Free
When it comes to monitoring your systems and applications, you'll soon start to look at email notifications to help you get alerts whenever issues are occurring. These types of email alerts are generally configured under an administrator email account or similar within the specific application where all emails go through.
Depending on the complexity of your systems and technologies, these types of email notification configurations may be straightforward via a graphical user interface (GUI), or you may be digging around at the command line using the console to configure specific packages to send out email notifications. One of the most important things though, beyond the configuration, is that you need to be able to view information about what has happened off the back of an email being sent by the system.
A common problem with email notifications utilizing traditional email technologies is that you have no idea if the recipient has received or even read the email. While you can accept this lack of visibility with certain emails, when it comes to monitoring and observability-related emails, this simply isn't fit for purpose.
Understanding the Importance of System Oversability Metrics
When it comes to getting visibility of the performance of your systems you can either go down the route of email notifications or platform notifications. We'll cover off the latter a little later. One key aspect is making sure that the right people are aware of the issues that are happening so they can respond accordingly.
It's no good for a system or application sending out emails if they aren't being read or acted upon. Getting your system metrics visible is key so that you can react and respond as quickly as possible. So let's jump straight into how you can track actions from your email notifications such as opens, clicks, and bounces.
Get Visibility of System Notifications via Email
So let's jump in and take a look at how you can get visibility of the opens, clicks, and bounces of your email notifications through the use of cloud services such as AWS Simple Email Service (SES), AWS Simple Notification Service (SNS), and AWS CloudWatch. There is a lot of different AWS services that have just been mentioned, so let's just set some foundations.
AWS SES as the name suggests is a service that is designed to both send and receives emails which allows you to decouple your email notification technology from your underlying infrastructure or corporate email platform. AWS SNS is designed as a fully managed notification service that can be used for both applications to application notifications along with application to person notifications. AWS CloudWatch is a monitoring tool to allow you to visualize core metrics from your systems.
To get started, you first need to create an SNS Topic by giving it a name:
When you are creating your SNS Topic, there is a large range of settings that you can configure depending on your specific use case. So make sure to read through the options available to you and configure what is right for you.
Next, you need to configure your SNS Notification settings to point SES to your SNS Topic:
You can see in the screenshot above that we've opted to look at basic SES Notification configuration settings by piping all different types of notifications through to a single SNS Topic. For more advanced configurations you may be more interested in tailoring this to send different types of email notifications through to different SNS Topics to give you the fine-grained control you need.
Next, you need to create a configuration set within SES and give it a name:
Next, you need to edit the Configuration Set you've just created and add a Destination so that information flows through to CloudWatch.
Now it's time to send a test email to yourself to check the basics are working as expected. To do this you need to use the Send a Test Email functionality within SNS and send a Raw email with the following content, note the information around the Configuration Set name that is contained within:
Off the back of sending this test email, once you open the email you have just received then check back to your CloudWatch metrics you'll see that the data has been updated within there:
Now time to test the more complex scenario around tracking Bounced emails. Thankfully AWS provides a handy email address that is designed to simulate email opens, clicks, and bounces which you can access when you send an email from SES using the Send a Test Email functionality with the email address specified so that your test email looks like the following. Utilize the same format as previously by sending a Raw email as follows:
And once the test email is on its way, you'll soon notice the statistics within CloudWatch updated accordingly:
We're going to assume that you've already got SES domains and email addresses configured for the above steps to work. If not, that's a topic for another time.
What you've probably picked by now is that the setup involved to track email opens, clicks, and bounces using AWS services such as SES, SNS, and CloudWatch is rather complex to set up for even the most basic of things.
So what we've walked through above is the following architecture which should help you visualize how the various microservices fit together:
Email Notifications and Best Practice
As with many things, just because you can do something, doesn't mean you should. As an organization and IT team, you need to consider your options carefully and weigh them up. The above setup has some severe limitations, beyond the natural complexities of setting this up in the first place.
One such limitation is that you have zero visibility of specific notifications that have been sent, you simply have a nice graph to show you the aggregated data over time. Imagine the scenario whereby you have a critical system error that needs urgent attention – given the above setup, how would you go about identifying how quickly someone responded to the specific issue? You can't. And it's this type of basic management information that soon becomes essential when you start to scale your cloud operations.
Basic email notifications can be great for quick wins and basic operations. They very soon become not fit for purpose and your needs as an organization demand more. This is where observability platforms come into play that hooks directly into your core systems to provide you with the actionable information you need in real-time.
You are always best to keep notifications for your systems and applications out of emails and centralized into a single platform that gives you the insights across your IT landscape to enable you and your teams to respond to important incidents as they arise.
Challenges with Observability
Getting real-time visibility of your systems and application landscape can be challenging at times, particularly with systems that aren't straightforward to integrate. Email notifications are generally the first step in this journey, the next step is often getting insights into the email notifications through the use of the tools mentioned throughout this blog post.
One core issue with getting visibility of email notifications is that this all depends on the underlying email technology in use. Many email systems and providers block the standard tracking technologies used to get insights into email opens. This can become an issue when you want to check who has seen critical notifications from systems that need to be handled.
As organizations soon realize, they need to start to move into a platform that is capable of scaling for their needs. A platform that is capable of making core metrics visible so they can be acted upon, not just reactively, but proactively. You don't want to be setting up complex email notification technologies when you could have this core functionality built into an observability platform.
Hopefully, this blog post has given you an insight into how to visualize key metrics when it comes to observing the performance of your notifications from your system and applications. There is no right or wrong approach for you to take, you need to understand where you are as an organization and move forward from there. The goal is to get away from email notifications and bringing everything into an observability platform to give you the real insight you need.
Give various tools a try to see how they could benefit your organization. Save time and money by getting out-of-the-box functionality rather than having to set up convoluted integrated microservices that provide only limited visibility.
Opinions expressed by DZone contributors are their own.