Track social links in your email signatures

August 2, 2015 3:47 pm Published by Leave your thoughts

When it comes to monitoring your digital marketing efforts, the more data the better.

But what about those pesky social links in your email footer (or any 3rd party website for that matter)? How many people click on them and which social channel is the most popular?

Email clients don’t (generally) support JavaScript and you can’t use campaign tagging because the user never hits your site to fire the GA code so you have to use a work-around to get visibility of these clicks.

The answer is a fairly straight forward redirect:

  • Send the user to a page on your site
  • Fire an event or virtual pageview
  • Redirect the user to the site they originally requested

For the user it’s a seamless experience, but you get the extra benefit of capturing all the valuable data.

Here’s how it looks in JavaScript:

< ?php
/*
This page tracks click-through's from email signatures.
User clicks button in email > this page loads > tracks page view > redirects to Facebook
*/
?>
// < ![CDATA[
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXXX-X', 'yourdomain.com');
  ga('send', 'event', 'email', 'click', 'facebook', true);
  ga('send', 'pageview');

  ga(function(){window.location = "https://www.facebook.com/YourPageUrlHere";});
// ]]>

Simply drop this code into a file with an easily identifiable name and link the social icons in your email signatures to it.

If you expect your emails to generate any significant amount of traffic, or you often link to 3rd party websites from properties that don’t have your GA code installed I’d recommend setting up a sub-domain and a separate GA property specifically for this purpose. The reason being that no matter what combination of non-interaction events or virtual pageviews you use to track clicks it will always have an impact on the accuracy of your data e.g. boucerates, exits, time on page etc. Remember this user just hangs around long enough to fire the GA code before being bumped off to their intended destination.

Anyway your final link might look something like this:

<a href="http://analytics.yourdomain.com/email/facebook-redirect.php"><img src="/icon-fb.png" alt="Like us on Facebook" /></a>

Note: I use PHP as I typically send url parameters to differentiate which link was clicked on and where to redirect, but I’ve limited this example to just Facebook.

I’ll never forget the first time I incorporated analytics into a corporate email footer, I mean nobody clicks on the links in an email signature right? Apparently no so.

Not only have I seen decent traffic driven from email footers, but with a bit of design flair and some persuasive calls to action an email signature can be an effective place to communicate your latest marketing message – just don’t go over the top!

Categorised in:

This post was written by WillyNilly

Leave a Reply

Your email address will not be published. Required fields are marked *