We’ve been using Google Analytics for some time, both for a number of clients, and for our own site. It’s a very real and impressive way to measure what areas of a site people are most interested in. What’s even better is that it’s free, you can signup anytime.
This is fine for a small site, but once you get into a site of any size then it becomes a tedious manual process, some content management systems can help, but from our experience these systems are limited in what they can do.
After some thinking and googling around for a solution that avoids the mass find and replace, we came across this clever idea – to attach some event listeners to all document links.
So I’ve taken the code and modified it a little to make it just for file downloads, and to cover more file extensions that the original. This will track the following file types:
- PDF (.pdf)
- Microsoft Word (.doc)
- Microsoft Excel (.xls)
- Microsoft PowerPoint (.ppt)
- Microsoft Visio (.vsd)
- Microsoft Visio XML (.vxd)
- ZIP Archive(.zip)
- RAR Archive (.rar)
- Text file (.txt)
- Downloadable CSS file (.css)
- Executable (.exe)
- NEW Windows Media Audio (.wma)
- NEW Quicktime (.mov)
- NEW Audio Video Interleave (.avi)
- NEW Windows Media Video (.wmv)
- NEW Mpeg Layer-3 (.mp3)
Hey presto you’ve now got tracking for all downloadable files!
UPDATE: The script now tracks external links as well as document downloads.