Improve Your Site’s Effectiveness With Google Analytics Event Tracking
This post is a taste of what’s to come in my forthcoming Google Analytics Ebook. Sign up to be notified of its launch and for a special promotional price.
Internal Link Tracking Using Google Analytics
On your blog or website you may have multiple links –such as icons or calls to action in different locations – leading to the same page, product or piece of content – but do you know which link placement and type is most effective?
Heatmap software and services such as CrazyEgg will give you this type of information in great detail and in a visual format. But there’s usually a cost involved and for a lot of cases it might be overkill if you just need simple comparisons. So while not as elegant, you can use Google Analytics to do some simple testing and comparison.
Warning – Don’t Use Link Tagging!
Google Analytics offers a link tagging feature which allows you to label links with a referral source, and other tracking info. On first glance you might think you could simply use this to tag your internal links in a similar way. However link tagging is designed to track promotional campaigns with traffic coming from external sources. If you use it for internal links, you will screw up your data. If someone arrives at your site via a link from another site, this would be tracked in GA as a referring site. However if that visitor then clicks an internal link that you’ve tagged, it erases that referral source and replaces it with whatever you’ve used in your link tagging.
Use Event Tracking
Event Tracking is probably the simplest way to track internal links. I use Yoast’s Analytics Plugin for WordPress, so the basic code is already included in the set-up, (if you check the box ‘track outbound clicks & downloads’) making tracking links a breeze.
Event Tracking Vs. Virtual Page views
Event tracking is generally preferable because it won’t artificially inflate your page view numbers. However if you want to include certain pages as Goals in GA, you will need to use virtual page views.
Implementation
All you have to do is add a little bit of code to the link you want to track. The general format is:
Onclick=”javascript:_gaq.push([‘_trackEvent’,’category’, ‘action’, ‘opt_label’, ‘opt_value’];”)
So your standard link code looks like this:
<a href="http://www.example.com”>link to content</a> |
A link with event tracking looks like this:
<a href="http://www.example.com" onclick="javascript:_gaq.push(['_trackEvent','ebook','homepage','button']);">link to page</a> |
In this example, ‘ebook’ is the category, ‘homepage’ is the action and ‘button’ is the label. You have to include a value for each of category and action, but the 3rd and 4th values are optional if you want to add further data.
To compare this link’s effectiveness with a text link on the same page you might add this code to that link:
<a href="http://www.example.com" onclick="javascript:_gaq.push(['_trackEvent','ebook','homepage','textlink']);">link to page</a> |
See The Results
You will see the results under Content > Event Tracking in your Google Analytics reports.
So by adding Event Tracking code to 2 links that go to the same page, you will be able to compare which one is more effective.
Do you have questions about this, or perhaps other experiences with how you use Event Tracking? Leave a comment below!
Other resources:
Justin Cutroni, who has literally written the book on Google Analytics, suggests rigging the site search feature to track internal links. I found Event Tracking to be a little easier to set up for my site, but you can find his method here.
Header image courtesy: http://www.flickr.com/photos/8669065@N06/2058473079/
I've heard you talk at several annual WordPress camps and you've got a gift for making complex stuff easy to understand. This event tracking post is another example that I'll share with my audience.
Hey Stephen – Thanks so much for your kind words! Glad you found the post useful. Google Analytics can do a lot of really awesome stuff if you dig deep enough…..