Most use Google Analytics to track simple metrics like page views, what keywords do people type in search engines before they land on our website, where the visitors are coming from, what pages are most popular and so on.
Now this kind of data can be collected using any other web stats program so here we explore some more powerful “click tracking” features of Google Analytics.
Track Clicks in Email Messages and RSS Feeds
Say you have written a wonderful article that fellow bloggers may like to blog about. You are likely to send them an email with a link to the story but how do you track if people actually clicked on that email link ?
Enter URL Builder - a free tool from Google Analytics. Just type the URL of your blog article and put the following values (Campaign Source=<Your Website Name>, Campaign Medium=”email”, Campaign Name=<Title of your Blog Post>)
Press the Generate URL button and send that new tagged link in your email message. Here’s a sample URL after tagging:
http://www.labnol.org/?utm_source=Digital-Inspiration&utm_medium=email&utm_campaign=My-Great-Article
To see how well your email performed, go to Traffic Sources -> Campaign and select the campaign name (which in this case is “My Great Article”).
You can extend this idea for tracking clicks to your site that may have originated from RSS newsreaders or even blog newsletters that are sent via FeedBlitz or FeedBurner.
Track Clicks on Links That Point to External Websites
Say one of your articles links to a story on CNN website or contains an affiliate link that points to some product on Amazon.com. How do you track which external links are popular with your site visitors ?
Fortunately Google Analytics offers a very easy way for tracking outbound clicks or links to pages that are on external websites (e.g. CNN.com). Just append the onClick attribute to your <a> tag as shown here:
<a href=”http://www.cnn.com” onClick=”javascript:urchinTracker(’/external/cnn.com’);>CNN</a>
You can then see the number of clicks to CNN.com from your own website by opening the Content -> Top Content report of Google Analytics.

If you have a large website, adding this urchinTracker function to every external link manually may be very tedious so here’s an alternative - add this small javascript from iqBlog to your website and all your outbound clicks with be tracked automatically.
Track Document Downloads (like Word Docs, PDF, MP3, etc)
If you link to files like PDFs, Word Documents, MP3 songs, Video Podcasts, etc that visitors can download from your website, consider using Google Analytics to track downloads so you have a good understanding of non-HTML content that is popular on your site.
Tracking file downloads with Google Analytics is easy - just add the following onlick function to your <a> tag.
<a href=”http://www.labnol.org/assets/downloads/pdf/How-To-Use-Google-Alerts.pdf” onClick=”javascript: pageTracker._trackPageview(’/downloads/GoogleAlerts’); “>
If the manual approach of tagging every link sounds impractical, get this javascript file from GoodWebPractices.com and put it anywhere before the Urchin code in your blog template. It will track all file downloads from your site automatically without you have to tag any link.
To see the statistics for file downloads and, navigate to the “Content” section then select “Top content”.
Google Analytics - More Advanced Techniques
Want more ? Watch these video presentations by Analytics gurus Alex Ortiz and Avinash Kaushik - they definitely know Analytics better than anyone else.
Find this article at: http://www.labnol.org/internet/design/google-analytics-track-clicks-emails-rss-feeds-web-pages/2476/
web: http://www.labnol.org/ email: amit@labnol.org


Reader Comments
nice collection of tips - thanks for sharing
Written by /pd on 03.03.08
An excellent post, Amit. I’ve been looking for something similar to track clicks in our feed at DesiPundit. We used a plugin, Feed Statistics previously but it messed up our cron job that keeps a track of links previously linked because it redirected all clicks through our domain. Would this solution also do something similar?
Written by Patrix on 03.03.08
Thanks for the information which might compliment the use of “Goals” (funnels of URL’s) that I use within analytics…
Written by Michael on 03.03.08
Hey amit, even I was exploring out Analytics few days back for such stuff. But lost my patience when I did it in a hurry. Thanks a ton for the info..
Written by maheshexp on 03.03.08
Will definitley try this with google analytics. Thanks for sharing the info Amit.
Written by Ganesh Shenoy on 03.03.08
One thing you should mention that you don’t and all the other related articles don’t mention except for google, is the fact that you need to make sure the javascript for the analytics code is above the javascript calls made by the onclick code.
Most people will have the analytics code near the bottom of the page, so the tracking won’t work.
This took me a while to find this out and I only found it out by reading how to do it from the google site itself. Might be obvious to people with basic javascript knowledge but it even took me a while to rejog my memory about it.
Written by David on 04.01.08
This is great - I’ve been doing this for years however now I’m finding archived emails are causing Google to index pages / urls WITH the tracking tags! This is a dupe content issue.
Should I be using the ‘noindex’ tag on these tracking tags within the email as well?
Written by Rob on 06.16.08