Do not pollute global scope - enables Google Analytics to work correctly
Google tells you to use analytics by including this snippet: <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create','unique tracker id', 'auto'); ga('send', 'pageview'); </script> i[r] is window['ga'] and if it's something truthy ([] is truthy) the snippet does nothing. At the same time foundationExtendEBI.js can not rely on window.ga being there (individual teams will have their own tracker, or not) so add an if-exists-then before each function call.
Please register or sign in to comment