down arrowMenu

UNI Webtools: Resources for Web Developers

Tracking page link click-throughs with Google Analytics

Posted on Wednesday, October 28th, 2009

If you would like to track the click-throughs on your website with Google Analytics, you can replace your normal link code

<a href="resources/about/" >About UNI</a>

with the following string of Javascript. The segment in parentheses can be named however you wish. I used the main_menu designation to indicate what section of the page that menu item is in.

<a href="resources/about/" onClick="javascript: pageTracker._trackPageview('/main_menu/aboutuni');">About UNI</a>

The link then shows up in the Content Overview section of your Google Analytics stats.