Track all pdf downloads on your site using jQuery and Google Analytics.
Thursday, August 21st, 2008
Recently I had a client ask me why their Google Analytics reports did not show if anyone had clicked or downloaded any of the .pdf documents on their site. I explained that the standard Google Analytics code does not track any external link clicks, and that .pdf files are actually considered to not be part of the website and therefore do not get included in reporting. Offering a solution, I went on to say that Google does offer a script that can be added to any “external” link you want to track.
The only issue was that this client had about 50 .pdf files - located all over their site. Updating them all would have been a real pain in the a**, but the client needed this data for reporting during a search-marketing campaign that was about to launch… uhg
I just knew there had to be a better way to get this done without sifting through a huge site, updating links one at a time. I’ve been using jQuery more and more these days as the needs arise and found myself reasoning this way…
