MiscellaneousProgramming Tips

How To Track Downloads On Your Site With Google Analytics

Google Analytics Tips and Tricks

A Great Tip When Using Google Analytics

Tracking downloads on your website is a fairly easy task, all thanks to Google Analytics. Many goals created by webmasters don’t actually entail visiting a web page, and it’s important to remember that we need to track and validate every form of user conversion to be successful in our Analytics campaign.

Because download links (links to files ending in .pdf, .psd, .xls, etc) don’t actually load any HTML when the user is directed to them, we must use the following Javascript code to push the data to Google.

<a href="http://www.example.com/files/map.pdf"
onClick="javascript: _gaq.push(['_trackPageview', '/downloads/map']);">

That’s it!

Allen Gingrich

Author Allen Gingrich

Allen has worked on the web for over a dozen years. Like many young entrepreneurs, he began with a small workspace in his basement, where he eventually formed Ideas and Pixels. The rest, well, is history. Allen enjoys fine wines, weight training, and beautiful, semantic code.

More posts by Allen Gingrich

Ready to quote your new website? We are.

Send us your RFP or request a call or meeting with us so we can learn more about each other.