Tracking Email
When you email your customers, there are three main actions that these people do:
- The person receives the email.
- The person opens the email.
- The person clicks through the email to get to your website.
If you use Mailchimp, take a look at our Mailchimp Integration. If you do not use Mailchimp, here are some ways to track emails using our APIs.
Tracking Email Sends/Receives
Method: Server-side API.
By tracking the people who receive emails, you can measure the baseline rate at which people open or click through your emails.
We suggest using our server-side API because 1) your own server-side process may already be sending the emails, or 2) your mail-merge program (like SendGrid) provides an API to list who is receiving emails, and that’s easier to parse using your servers.
The server-side code for doing this might look like:
KM.identify('[email protected]')
KM.record('Received Email', {'Email Content Received' => 'Welcome Email'})
# Like any other property, "Email Content Received" is optional, so include more properties if you want to use them.
Notice we’re identifying the recipients by their email address. You can use any other unique identifier here, but it’s very important to use a consistent ID when tracking Views and Clickthroughs, and activity beyond email interaction.
Tracking Email Views
Method: Beacon API or server-side API.
Our Beacon API lets you embed an image in your emails so that the act of loading the image records the “Viewed Email” event. Alternatively, your mail-merge program’s API could allow you to list people who have viewed emails, and that’s easier to parse using your servers.
<img src=`http://trk.kissmetrics.io/e?_k=YOUR_API_KEY&_n=Viewed+Email&_p=john%40smith.com` />
This records the Viewed Email event, attributed to [email protected] (@ is URL-encoded as %40), which is the same ID I used in Step 1.
Tracking Email Clickthroughs
Method: Campaign Tracking with UTM tags or our URL API.
Most importantly, you’ll want to be able to see if people land on your site directly from the email you sent them. To do this, you’ll tag links within your emails with information that indicates:
- They Clicked Through Email
- The identity of the customer (use the same one as the previous two steps)
- Any additional properties to help you organize multiple email campaigns
Our article for How to Track Campaign URLs is most thorough in explaining how to set this up.
Related Resources
- Mailchimp Integration. Our Mailchimp integration records these three steps with a minimal setup from you.
Updated over 4 years ago