Google Analytics LogoI’ve learnt something about Google Analytics tracking and I want to write it down somewhere to remember it for the future. What better place than my blog so I also let everyone else know about this small Google Analytics tracking Tip.


I wanted to precisely track my sidebar outgoing clicks so when I go into my Google Analytics interface I can see how many people have clicked on any link within my sidebar. To do this, you have to manually add a small code on each link.

Append this code on each link you want to track :

<a href="http://www.example.com" onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');">

Image with the code (just in case wordpress modified the code above) :


Google Analytics Tracking

Note : There is a space between javascript: and pageTracker

Log your links into an logical directory structure!

In the example, the directory structure is /outgoing/example.com but on my blog I have done it differently.

For all the links on my sidebar, I have used the directory structure /internallinks/sidebar/nameofthelink

For the links in my header, I have used the directory structure /internallinks/header/nameofthelink

For my footer /internallinks/footer/nameofthelink

In Google Analytics, you will find the results after 24-48 hours inside the CONTENT menu and by clicking on CONTENT DRILLDOWN

Warning! If you manually track clicks by using this code, Google Analytics will count each click as an extra pageview! This will inflate your pageview statistics so you might want to create a filter to remove those additional pageviews from your general Google Analytics statistics. See how Here.

You can see a summary of this code in the Google Analytics Help Pages : Here

Related Images: