Every WordPress site has to send emails, but there’s no built-in tracking for them. This makes it impossible to know if your emails are being opened and clicked or just sitting unread in someone’s spam folder.
This problem tends to scale with size. The larger and more successful the site, the more you need a way to track email results. In this article, I’ll show you how to use Amazon SES and CloudWatch to track your emails, and offer an alternative with a much easier setup process.
Amazon Simple Email Service (SES) is a relatively low-cost and effective solution for sending site emails that you can set up in three steps. Combining it with CloudWatch, another Amazon Web Services product, gives us insight into how our emails perform.
You can also use Amazon SES with our WP Offload SES plugin. WP Offload SES Lite includes a Setup Wizard to guide you through the process of creating and configuring an AWS account, including creating an IAM user. The full version, WP Offload SES, builds on the free version with built-in email tracking.
Benefits of Email Tracking
There’s a lot you can do with email tracking data once you’ve got your hands on it. Even just glancing at a report paints a picture, at least in broad strokes. You can see which emails have higher open rates, what leads your audience to click, etc. Actually digging into the data extends the benefits you can expect:
Tracking performance: You’re wasting money if you run an email campaign without measuring performance. Tracking tells you who to target with further emails, sales calls, and remarketing efforts.
Improving audience experience: You’ll gain insights into what interests your audience and what leaves them cold, so you can craft better content.
Spotting trends: With enough insight into how your emails are performing, you’ll be able to spot emerging trends among your audience. This can help you create more compelling content, focused on the topics your audience is most interested in.
How Email Tracking Works
When you send a regular email, through WordPress or otherwise, there’s no way to tell if it was opened or clicked. Email protocols simply don’t have that capability. Luckily, there are a few workarounds that will get the job done.
Email opens are typically tracked by inserting an image that is stored on a server (in this case, Amazon) into the email. When the email is opened, the image loads from the server and the server logs the email as being opened. Usually, the image loaded is a discreet 1-pixel transparent image (also known as a tracking pixel), so it doesn’t interfere with the layout of the email.
This won’t work if the recipient has images disabled in emails or if emails are sent as plain text, so the technique isn’t 100% foolproof. However, this remains one of the most common and effective ways to track email opens.
Click tracking works in a similar way. Links first go to a server that logs the link as clicked, and then redirect to the actual URL requested. Often URL shorteners are used, so smaller and tidier links can be used while tracking clicks at the same time.
Email Tracking With Amazon SES
Amazon SES offers email tracking, which integrates with Amazon CloudWatch and/or Amazon Simple Notification Service (SNS). I thought it’d be a perfect compliment to our WP Offload SES Lite plugin, so I dove right in.
To enable the open/click tracking, you need to create a configuration set in your Amazon SES console so SES knows to track the open/click events and publish them to your provided destination.
To set this up, I created a configuration set called “Engagement.” Amazon provides a lot of options for creating configuration sets, but I’m going to leave most of these at their default settings for simplicity’s sake. However, the importance of these settings tends to scale with the volume of emails you send, so they’re worth a closer look:
Sending IP pool: This allows you to associate a group of dedicated IP addresses (the IP pool) with the configuration set. IP pools can be used to spread email load among the IP addresses in the pool, as well as things like separating different types of emails into different pools.
Tracking options: By default, the tracking pixel used is hosted on Amazon’s servers. Checking this box lets you set a custom domain instead.
Transport Layer Security (TLS): Amazon SES uses opportunistic TLS. This means it tries to establish a secure connection, but will send the message unencrypted if that connection can’t be established. Checking the “Required” box prevents Amazon SES from sending without a secure connection.
Reputation metrics: This option adds bounce and complaint tracking at an additional charge.
Suppression list options: You can use this to associate the configuration set with a custom suppression list. It will otherwise default to using your account-level suppression settings.
Tags: This allows you to add tags to your configuration set, which is handy if you have a lot of them.
Once I was done reviewing (and ignoring) the options, I clicked Create set.
The configuration set doesn’t do much yet. For that, we need to add a destination. For the event types, I selected “Sends”, “Opens”, and “Clicks”, as these were the metrics I was interested in having graphed.
I was a little concerned about the notice at the bottom regarding custom redirect domains. This pops up when you select either “Opens” or “Clicks”. Did this mean these wouldn’t be tracked without a custom redirect? After some more digging around in Amazon’s docs, I discovered that it will still track them. The main advantage of setting up a custom domain is to provide your recipients with a more cohesive experience. I’m keeping things as simple as possible, so I forged ahead without setting up a custom domain.
The next step is to configure the destination itself, including the type (Amazon CloudWatch, Amazon Kinesis Data Firehose, etc.)
This was where I ran into my first hurdle. It was asking for a “Dimension Name” and “Default Value”, and it wasn’t clear exactly what those should be. After reading and rereading the docs on the subject, I realized that I should be specifying the use of a configuration set as the Dimension Name and its name as the Default Value.
After figuring that out, I realized there was another challenge: WP Offload SES doesn’t support setting custom headers. These are needed to specify the SES configuration set created earlier. To get around this, I added a custom function to my theme’s functions.php
file that hooks into the wp_mail
WordPress filter. This function adds the header that lets SES know that the email being sent should be tracked:
function ses_wp_mail_headers( $mail ) {
$mail['headers'] = "X-SES-CONFIGURATION-SET: Engagement";
return $mail;
}
add_filter( 'wp_mail', 'ses_wp_mail_headers' );
With that in place, Amazon started inserting the tracking pixel and converting links to trackable URLs, with one exception: WordPress notification emails weren’t being tracked. This was happening because WordPress doesn’t send out emails as HTML, and sends them out as plain text by default.
It is possible to override the content type that WordPress uses, but this has the unfortunate side effect of breaking the formatting of WordPress notification emails since they aren’t coded to use HTML:
This means that you’d either need to customize the notification emails yourself or use another plugin to customize them for you. I tested out the well-reviewed WP HTML Mail plugin, and it seems to be just the tool for the job. The notification email templates provided by the plugin look great, and it even sets the correct content type for you.
After installing that, notification emails were finally being tracked by CloudWatch! To access that tracking data, I created a widget in the CloudWatch dashboard and included the “Send”, “Delivery”, “Click”, and “Open” metrics from the SES engagement. I set the widget type to “Number” (as opposed to a line graph or bar graph) as I found that the easiest to quickly parse. I also set the “Statistic” value to “sum” for each of those metrics instead of the default “Average” so we can see the total number of opens and clicks in the given reporting period.
With all that in place, we have our very own “Engagement” graph with some basic info on the number of emails being sent, opened, and/or clicked.
Email Tracking With WP Offload SES
There’s a way to use Amazon SES to send all your site emails and get access to tracking reports, engagement numbers, etc., without having to create a CloudWatch destination or go through the hassle of hooking it into your site. WP Offload SES does this for you. Plus you don’t need yet another plugin to convert text emails to HTML just so you can track engagement.
WP Offload SES includes a setup wizard that walks you through the process of setting up Amazon SES. Once you’ve completed that, you can set up email tracking by flipping two toggles: “Enable Open Tracking” and “Enable Click Tracking.”
The plugin assembles all of the information in an easy-to-read table with search functionality. You can easily see which of your site emails are generating engagement and which ones aren’t even hitting people’s inboxes.
Conclusion
Despite managing to get it set up, I can’t say I recommend using Amazon’s tracking in conjunction with WordPress and WP Offload SES. It’s a lot of work to set up, doesn’t work with the default WordPress site notifications, and you don’t get a very detailed graph unless you add a lot of custom metrics, which drives up the price of CloudWatch. Amazon has tons of documentation on CloudWatch, but that’s actually part of the problem. CloudWatch can be used for so many things that it can be difficult to figure out exactly how to get it to do something relatively simple like tracking emails.
In addition, while CloudWatch pricing is transparent, it can still be tough to figure out exactly what you’re going to owe at the end of the billing period.
The good news is that WP Offload SES can give you the deliverability and low cost of Amazon SES, without the need to dive into documentation and figure out how to set it up. As we’ve seen, WP Offload SES also handles click and open tracking out-of-the-box, so you won’t have to set anything up or pour through pages of Amazon’s technical documentation.
Are you tracking your site emails already? How have you set it up? Have you ever tried to do it with SES? Let me know in the comments.