(function($){ $(window).load(function() { //Track Downloads $('a').filter(function() { return this.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/); }).click(function(e) { ga('send','event', 'download', 'click', this.href); }); //Track Mailto $('a[href^="mailto"]').click(function(e) { ga('send','event', 'email', 'send', this.href); }); //Track Outbound Links $('a[href^="http"]').filter(function() { if (!this.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/)){ if (this.href.indexOf('endtimestruth.com') == -1) return this.href; } }).click(function(e) { ga('send','event', 'outbound', 'click', this.href); }); }); })(jQuery);