brain tags Je Maintiendrai

Google Analytics Event tracking

One of the most interesting parts for web site owners are the access statistics, and Google Analytics offers one of the most complete statistics solutions, which I use on a weekely basis for my most succesful blog El Canasto.

Besides being a typical blog with pages, I offer calendars for downloading, and of course I also want to track those downloads. When two years ago I started with the downloads I search Google`s help files for a solution to track them, and found a small javascript sniplet that when a visitor clicks on a download link registers the download as a pageview. This trick allowed me to analyse the downloads.

The disadvantage of this trick is that it inflates the pageviews, and I never have been completely satisfied about this solution. You can imagine my happiness when last week I discovered the Event Tracking feature, designed specifically to track downloads, videoplays, etc.

I quickly changed my code to use a javascript sniplet like the following:

onclick="javascript:pageTracker._trackEvent('Downloads',
'XLSX', '/calendario-compacto/calendario-compacto-2009'); "

This sniplet registers the download under the category Downloads, the action XLS and the label /calendario-compacto/calendario-compacto-2009. Google Analytics has Event reports by category, action and lavel, so now I know for example which of the four file file formats are more popular:

Events report by file type