Winning the Internet

Track outbound links with Google Analytics Event Tracking

After a great run, the Winning the Internet blog has been retired. However, you can still keep in touch with New Media Mentors here.






google analytics event tracking

If you’ve got just a basic Google Analytics setup, you’re likely missing out on a lot. For example, have you ever noticed that Google Analytics only tracks clicks on links that lead to webpages that are part of your site?

For most of us, clicks on links to other sites aren’t tracked at all. This can be a major drag, especially considering that donate and take action links often leads to third-party sites.

Fortunately, the good folks over at Google have created a solution! It’s called Event Tracking. With the right coding, you can track outbound links and just about any type of interaction within a page.

First you’ll need to add some code to your site – I’ll explain exactly how to do that in a moment. Once your code is in place, you’ll be able to view clicks on outbound links by looking at the Top Events report in the Content section of Google Analytics.

Your report will look something like this (depending on how you add the code to your site). First you’ll see something like this report that shows the total number of events and unique events (think clicks).

google analytics outbound rollup

Once you drill down (I clicked on Outbound Link in this example), you should see a list of the links that were clicked, like this:

google analytics outbound links all

Now you’ll always know exactly how many people clicked on your donation link!

I my opinion, outbound link tracking is the easiest type of event tracking to implement. To set it up, you’ll need to add some code to your site. There are two ways to do this.

Manual link tracking

To manually track clicks on outbound links as events, all you need to do is add a bit of extra code to each link. If your coding skills are limited and you’ve got a small site with only a few outbound links, this could be a good choice. Here’s some example code from Google:

<a onclick="_gaq.push(['_trackEvent', 'Outbound Links', 'Click', 'Google']);" href="http://www.google.com/">Google</a>

To use this code for your link, just copy and paste the code, and make the following changes. http://www.google.com/ should be the url you’d like to link to. The first Google (between the single quotes) should be whatever you’d like to name your link, and the second Google (between the carrots) should be the text you want to be hyperlinked.

Automatic link tracking

If the idea of manually tagging every link on your site makes you want to cry, you should probably try automatic link tracking. This involves making sure you have asynchronous tracking installed on your site, and adding a little bit of JavaScript code that will automatically tag the links for you. This is fairly technically involved, so I won’t go into the details of how to do this here. Axllent.org has a pretty good how-to though.

Tracking video interactions and other actions

You can also use event tracking to track how people interact with a video on your site (play, pause, etc.), or anything else that involves clicking within a page (initializing a game, etc.). The coding involved here is a bit more complex than with outbound links.

Unfortunately I haven’t yet found a resource that breaks this down and makes it easy to understand. If you’ve got a good source, please share it in the comments! However, if you’re feeling motivated and you know how to code, Google’s code site has some instructions.

About Melissa Foley

Melissa is the Director of Training and Mentoring for Netroots Foundation and New Media Mentors. She aims to use her MBA + nonprofit background to teach organizations to use new media tools strategically.






,

3 Responses to “Track outbound links with Google Analytics Event Tracking”