How To Track Email Conversions in GA

Tracking Goals in Google Analytics is vital to tracking conversions and having a grasp on your performance over time. However, it's important to remember that Goals can apply to so much more than simply a sale or page view. A client of ours measures a conversion as simply an email being sent to one of their specialists,  whose email details are displayed on relevant pages as the users browses around. Currently tracking and measuring these emails can only be carried out by cc-ing another email address each time an enquiry is sent. With the client's service being of extremely high value, and an email being the first step to a sale, this primitive way of tracking in not sufficient.

A quick Google Analytics goal creation, followed by some Javascript reworking in your code means ten minutes work can ensure you're tracking email conversions in a much more sophisticated way.

Step one:

Assuming Google Analytics is installed on your website, head over to the 'Goals' section and hit  'Add Goal'

We'll need a name that describes this Goal correctly for future reference and the Goal type must be set to 'URL destination'.

In Goal Details we need to set the 'Goal URL'. This is essentially a fake page simply in place for tracking, and can be anything you like as long as it remains the same in your JavaScript code (see below),  for now we'll just stick with a variation on the Goal Name. Goal Value is optional and can be left blank, however if you can apply a Value to each email enquiry sent for yours or your client's business - then stick it in here.

Step two:

With the Goal in place we need to apply some simple JavaScript to our email address html to ensure each email click is tracked. So where a typical email address might appear like this:

<a href=””>Email John Smith</a>

We need to apply some javascript so the code looks like this, ensuring the URL in the javascript code is exactly the same as the Goal URL set in Analytics:

<a href=”” onClick=”javascript:pageTracker._trackPageview(’/mailto/email’);”>Email John Smith</a>

Ok, so now for the hard part - applying this code to every email address across your site. Our client literally has hundreds of different email addresses across the website and editing the html code for each of these manually would be a colossal waste of time. By putting our development hat on for a few mins and learning a little jquery, we can edit all these email addresses across the site in no time!

Sticking the following code into the header of each page ensures each anchor with a href that starts with 'mailto:'  has the page tracking code appended to it:

$(document).ready(function() {

Read more about the attributeStartsWith selector here.

Step Three:

Sit back and watch your email conversions being tracked!


Get blog posts via email