JQuery undefined when tracking comments and loading in the footer
-
This comment tracking code outputs a few lines above where my theme is calling, in the footer, a CDN-hosted script with the handle ‘jquery’ (we are unregistering the WP’s stock ‘jquery’ script)…
<script type="text/javascript"> jQuery(document).ready(function () { jQuery('#commentform').submit(function () { _gaq.push( ['_setAccount', 'UA-*******-2'], ['_trackEvent', 'comment', 'submit'] ); }); }); </script>
We don’t know what “jQuery” is yet, so:
Uncaught ReferenceError: jQuery is not defined
Is anyone else having this issue, or is there something silly I’m doing wrong? I think I can workaround it if I really need to (I don’t) but it seems like a bug.
I will also accept convincing arguments that jQuery should be in the header: must be convincing enough for my boss ??
https://www.ads-software.com/extend/plugins/google-analytics-for-wordpress/
- The topic ‘JQuery undefined when tracking comments and loading in the footer’ is closed to new replies.