jQuery is Not Defined
-
I’m getting a jQuery is not defined error from this code:
<!-- BEGIN GADWP v4.8.1.2 Universal Tracking - https://deconf.com/google-analytics-dashboard-wordpress/ --> <script type="text/javascript"> (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('amt-inc.ca') == -1) return this.href; } }).click(function(e) { ga('send','event', 'outbound', 'click', this.href); }); //Track Hashmarks $('a').filter(function() { if (this.href.indexOf('amt-inc.ca') != -1 || this.href.indexOf('://') == -1) return this.hash; }).click(function(e) { ga('send','event', 'hashmark', 'click', this.href); }); }); })(jQuery); </script>I have jQuery loading in the footer prior to the rest of my scripts. Obviously it needs to load in the header for this plugin to work. It seems to me like you haven’t set up the dependencies correctly? I shouldn’t have to modify my theme code to fix this.
https://ww.wp.xz.cn/plugins/google-analytics-dashboard-for-wp/
The topic ‘jQuery is Not Defined’ is closed to new replies.