Mobile app version of vmapp.org
Login or Join
RJPawlick198

: Redundant Parameters in Google Analytics JS Snippet Google Analytics provide this snippet of code to copy and paste to a site: <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

@RJPawlick198

Posted in: #GoogleAnalytics #Javascript

Google Analytics provide this snippet of code to copy and paste to a site:

<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxxxxxx-1', 'mysite.com');
ga('send', 'pageview');

</script>


But the a and m variables used in the function signature are not used throughout the code at all. Is it safe to remove them? I can't see any negative implications that could arise, and I don't understand why Google put them in the first place (i.e. their code minification tools should have probably removed them in the first place).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @RJPawlick198

1 Comments

Sorted by latest first Latest Oldest Best

 

@Michele947

I see a and m being used.

.insertBefore(a,m)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme