Recently I was exploring Google Analytics to track website visits on my clients website. Google Analytics (GA) is indeed a powerful tool yet simple to use, implement, and most of the things are pretty straight forward. Even developers like me who are not from the SEO or Analytics background can setup website tracking pretty easily without much learning curve and can have a detailed analysis reports about the site usage, user patterns, etc.
Most of the things Google Analytics appears to do on its own without any efforts from our side to make it happen except (and off course) the GA java script code that we need to embed on each pages on our website. Again, this is pretty simple if your website is well designed and programmed (include files are good) so that from one location or file you can have the GA code added on every page automatically.
Once your GA code is in place Google starts tracking almost everything about your website usage and soon you get useful reports inside your website profile in Google Analytics. All pages, All clicks are tracked automatically (or say automagically). Such a powerful tool!
onClick event added inside the
<a> tag. The href attribute contains the URL of the external website and the
pageTracker._trackPageview('/outgoing/example.com') contains the argument with which you want to tag your outbound link click as a page view. Once this is in place Google starts tracking clicks on your outbound links as well, and the top content reports would show the tag you have assigned (in above example: ‘/outgoing/example.com’) as a page view to external site. This will give you a useful information about how many users are clicking on such outbound links and taken to external websites. Also its wise to organize and tag such links in some logical directory structure so that you can distinguish from which outbound link and from which page your users are going to any external site.
This is just a brief description about it, you can learn more about this topic at GA Tutorials. The above code snippet is applicable to only the latest version of GA tracking code.