I'm somewhat confused. I keep finding a lot of examples (like this and this) that explain how to track file downloads with Google Analytics. The problem is that most articles are pretty old and now Google uses the new "Universal Analytics" tracking code.
But here's my dilemma. I don't want to mess up my download links by installing a code that may not work on some web browsers (see comments for that page.)
So I'm curious, is there the official instructions (from Google for year 2014) on how to set up file download tracking that has an example of JavaScript that they recommend?
Tracking downloads is straightforward, and is very similar to all other GA onclick events. Generic download tracking code could look like this, for example:
<a href='/some/file.pdf' onclick="ga('send', 'event', 'download', 'click', $(this).attr('href');")>Click to download</a>
This sends to GA a download event characterised by a "download" category, a "click" action, and a label using the href attribute of your link.
Here's a site (from 2014!) that you might want to check out: http://netnix.org/2014/04/27/tracking-downloads-with-google-analytics/.
Hope this helps.