AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

4K members online now
4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Google Analytics Script

Explorer ✭ ☆ ☆
# 1
Explorer ✭ ☆ ☆

Hey Guys


Wondering if anyone can explain the difference between these too someone who hasn't really worked alot with coding. I tried looking online but i couldn't really find anything that really explains it.


The one currently on the website is below.




        function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;









Here is the code from analytic that i need to update it to.




  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),




  ga('create', 'UA-2022525-1', 'auto');

  ga('send', 'pageview');



So what is the difference between (i,s,o,g,r,a,m) & (b,o,i,l,e,r)? Should i just update the old UA code on the website and leave (function(b,o,i,l,e,r)?

1 Expert replyverified_user

Re: Google Analytics Script

Top Contributor
# 2
Top Contributor
Hi Cedric,

A little bit of coding background first. Those letters i, s, o, g, r, a, m and b, o, i, l, e, r are placeholders for the parameters that are used in a "self-invoking anonymous function'. This is another way of saying that the function that is defined, with the given parameters, will run immediately after it is has been created. It also, as you might have guessed by the word "anonymous" does not have a name. Each letter corresponds to a parameter that is to be passed into the function. The parameters are defined at the end of the function in the comma separated list (ie. "window", "document", "script", "ga"). I won't go into any more detail, but what is key here is what those functions are doing.

A note of caution. I am not an expert developer here, so definitely do your due diligence and investigate some more.

The first function looks like it could a "boilerplate" function. "Boilerplate" is a name for something that is to be used as a template - something to get you started. Typically you need to add and build functionality on top of the boilerplate. (And somebody jump in if I have misspoken). Note that this code is not officially supported by Google. Although it looks "analytics"ish to me, I can't be certain without testing it out.

The second function is very familiar (at least to this community) and is the standard tracking code. This is the code that you should be using if you want to avoid any problems with GA.

The first function could be working perfectly well for you, and if so, then go ahead and keep using it, but you need to know the risks of using that, with the realisation that there may not be a lot of support for it if it does break somehow. The second function is legit, and if you have problems with it, then at least you can always come back here for support. Smiley Happy

Hope this helps.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn