1. Download jQuery and install Goolge Analytics.
Go to jQuery.com and get the latest version. Then add the script include into the header of your site.
Now go to Google Analytics. Set up an account and follow the directions to get tracking running. Go ahead, do it now, I’ll wait. You should now have some script on your site that looks like:
2. Add the jQuery to start tracking links.
Next use a jQuery selector to select all a tags on the page with a rel=”external”. To do this, pass jQuery the a tag element with the attribute selector option.
with this we add a click function to our jQuery object.
With the last part we put in the function call to the Google Analytics code and we pass it the href that our a tag is pointing to.
This code makes the call to Google Analytics and passes a page path of “/outgoing/” and the url of where the click was headed. In your Google Analytics under content, you will see pages that start with “/outgoing/”. These are clicks that took people off your site. See below for how it looks in Google Analytics.