Google Analytics: Track PDF Downloads using Analytics.js

This blog is in continuation to existing one “Track PDF links on webpage” which was based on Google’s ga.js, the method which is now obsolete.

See GA Upgrade for more details.

Coming back to main objective here… we can still continue achieve of motive of tracking PDF clicks or downloads using below script:

Note: You need to include jQuery (mentioned below) to your page for leveraging this code in HEAD section of HTML.