In order to track how many times someone clicks on a link, you need to add some special code. But before you get started – first things first. If you haven’t done so already, go set up an account on Google Analytics.
Once you have verified your site you many continue. In this example I will explain how to write code to track how many times someone has clicked on a .pdf file to download and view the file.
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
Step 2: Add an onClick event to your hyperlink:
Step 3: Log into Google Analytics and click on “Content” on the left menu.
Step 4: In the filter box, type the special name you gave your tracking code. In this example I would type SpecialOffer/FirstPage.
Try it out! Happy Coding!