Get In Touch

Blog


History of Google Analytics Code

Posted by GMI Blogger Posted in Miscellaneous,Web Analytics
September 14th, 2015 at 11:49am

Google Analytics Usage Stats 2015Google Analytics is one of the most popular Web Analytics platforms to monitor website and mobile application traffic.

According to BuildWith Trends data as on 2015 September, Google Analytics is being used in 59% of the total websites across the globe.We can understand its importance from the fact that the following web analytics platforms; Quantcast Measurement and Facebook Domain Insights, are only used by 4% of the users.There’s no doubt that Google Analytics is one of the most preferred web analytics platform used by businesses and service providers in Dubai, just as in other cities within UAE. It has become a de facto standard to track the online performance and gain meaningful insights about a website’s performance.

Google Analytics-Then and Now

The goal of this blog post is to provide insights on the major Google Analytics code changes after 2005. As you may already know, in order to track the website visitor, Google Analytics (GA) uses the JavaScript (.js) code which needs to be placed on all pages. By checking the prelude in the .js file, we gain insights on the GA version used in that specific website.

Google Analytics JavaScript Timeline

It all started when ‘Urchin Analytics’ from the company ‘Urchin Software Corp’ was acquired by Google in April 2005 to create the first version of the Google Analytics Platform. We will examine the major changes in the Google Analytics Javascript code in its history.

History of Google Analytics Javascript Code

1. Urchin Analytics Code

Even though Google acquired Urchin Analytics in 2005, they did not make any changes in the underlying script. Google retained the main javascript file urchin.js when it was released to public for free.

Urchin Analytics

<!— Sample Urchin Analytics Code –>

<script src=”http://www.google-analytics.com/urchin.js”

type=”text/javascript”></script>
<script type=”text/javascript”>
_uacct = “UA-XXXXXXX-X”;
_userv = 2; urchinTracker();
</script>
<!— Sample Urchin Analytics –>

2. Google Analytics Synchronous Code

The traditional GA code or the Synchronous GA code had ga.js and PageTracker component in it. In 2007, Google recommended placing the GA code just before the closing </body> tag in the HTML source code. So it’s only when the entire content in a webpage gets loaded that the Google GA code gets executed and the analytics interface records the visitor data.

google analytic Synchronous

<!—Sample GA Synchronous Code –>

<script type=”text/javascript”>

var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src='” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
try
var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
pageTracker._trackPageview();
} catch(err) {}
</script>

3. Google Analytics Asynchronous Code

The Asynchronous Analytics Code was introduced by Google in 2009. The two unique components in this version were _gaq.push and ga.js. From the Asynchronous Analytics version, Google recommended placing the GA code just before the closing </head> tag.  So whenever a webpage gets loaded, the GA script placed at the top executes itself and collects the data back to its respective website’s database. A few of the benefits of the this version  when compared to its previous versions of the GA Code would be its faster loading time and better accuracy in data collection.

google analytics asynchronous

<!—Sample Google Analytics Asynchronous Code –>

<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-X’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) +
‘.google-analytics.com/ga.js’;

var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);})();
</script>

4. Google Analytics with Display Advertising Code

The Google Analytics with Display Advertising Code was introduced by Google in December 2012. The updated GA code had improved features for Remarketing which became helpful for better targeting of Display ads. Also, the Enhanced Link Attribution feature that was introduced in this version offered improved visualisation of clicks in the In-Page Analytics Reports.

Display advertising

<!—Sample Google Synchronous With Display Advertising Code –>

<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXX-X’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) +’stats.g.doubleclick.net/dc.js’;

var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

5. Universal Analytics Code

The Universal Analytics Code was introduced by Google in 2013. It uses the ‘analytics.js’ script in its code. When compared to the previous version, the Universal Analytics has way more options to track signed-in users, advanced visitor segment creation, custom dimension creation etc. The Universal Analytics code offers more precise visitor tracking data since it eliminates duplication arising from the same user who has logged in from multiple devices at a time.

Universal analytics

<!—Sample Universal Analytics Code –>

<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-XXXX-Y’, ‘auto’);
ga(‘send’, ‘pageview’);

</script>

How to check if GA Code is used in your website?

Open the source code of the website and check the GA code (You can right click on the webpage and select the “View Page Source” option or, you can use the shortcut key ‘Ctrl+U’ to open the website’s source code). For example, search for the term “ua-” in our website source code. You will find a unique Google Analytics Tracking ID which is placed in our webpage to track the visitors to our official website.

source

If you check the source code’s Google Analytics code it is “UA-2332705-1”. Examine the associated JavaScript file in the webpage. If you refer our (GlobalMediaInsight.com) website’s GA code, you will find that near the UA- code there is analytics.js denoting that in our website we have Universal Analytics Code (highlighted in yellow).

source1 You can refer the main GA Code History image above to know the GA Code version which you are using in your website.

Why is GA Code relevant now

If your website was launched before 2009, there is a chance that you would be using the old GA code in your website. During our SEO Website Audits, we have witnessed a recurring pattern where most of the old websites tend to retain the old Google Analytics code in spite of creating new responsive websites.

Where to get the latest Analytics Code in Google Analytics?

In case you’re unsure about where to collect the latest GA Code, refer the image below.

web

Log in to your Analytics account from the URL https://www.google.com/analytics/ with your credentials.

  1. Select the ‘Admin’ menu on top
  2. Select the Website Profile that you need to update
  3. Click the Tracking Code option under the Tracking Info menu
  4. Copy your latest Tracking code and add it above the closing </head> tag in every webpage of your website

Is your website’s GA Code version up-to-date?

Please open your website’s source code and check its GA Code version. If you find that it’s not the Universal Analytics Code (analytics.js) or the latest Google Tag Manager code (GTM), then it’s time to upgrade your GA Code for a perfect visitor data tracking. If your business is looking for professional

Web Analytics consultation, feel free to contact us.  Our Google Analytics certified team will ensure that you receive in depth data insights and all your web analytics objectives are met. Call us or drop us a line so that we can discuss your requirements and help you in making your online business goals a reality.

References

http://trends.builtwith.com/analytics
(The Entire Internet)
https://en.wikipedia.org/wiki/List_of_web_analytics_software
https://en.wikipedia.org/wiki/Urchin_(software)

 
« UAE’s getting read ... UAE steps into the I... »
Share this: