Hacker News new | past | comments | ask | show | jobs | submit login

If you have jQuery on your website alongside Google Analytics, you’re loading two jQuery libraries without you knowing due to Google using it too on their analytics script.



Do you have a source on this? I can't believe this is true and my 2-3 google searches say it's not.


https://www.googletagmanager.com/gtag/js

Search “jQuery” in there, first result will be the copyright comment plus the version.


Is that the same JS used for Analytics? I think that's just for GTM. Here is the analytics script I see more often and it doesn't have jQuery: https://www.google-analytics.com/analytics.js


It’s the new snippet for analytics.


it doesn't export to the global namespace though:

    <script src="https://www.googletagmanager.com/gtag/js"></script>
    <script>$</script>
    ReferenceError: $ is not defined

    <script>jQuery</script>
    ReferenceError: jQuery is not defined




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: