Warning: Your browser is very out-of-date. You should upgrade to a better browser.

The new Google Universal Analytics provides the opportunity for own measurement values and dimensions and allow you to track usage across platforms. Universal Analytics introduces a set of features that change the way data is collected and organized in your Google Analytics account, so you can get a better understanding of how visitors interact with your online content.

Updating Code

Unless you’re using advanced features the upgrade process for most people will be pretty easy. Find where your code is installed on your website and replace…

<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://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

…With the Universal Analytics code (adding your Analytics ID to the code)…

<!-- Google Analytics -->
<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>
<!-- End Google Analytics -->

Save it and upload, then login to Google Analytics and upgrade your account there to start recieving your analytics.

Upgrade to Universal Analytics

If you’re using more advanced analytics Google has put together a pretty useful guide to upgrading your code from ga.js to analytics.js. The Universal Analytics Upgrade is a two step process you can follow to turn all of your classic Analytics properties into Universal Analytics properties and implement a Universal Analytics tracking code.

Magento

Magento is a feature-rich ecommerce platform built on open-source technology that provides online merchants with unprecedented flexibility and control over the look, content and functionality of their ecommerce store.

About Magento Ecommerce · Magento Posts

Related Magento Posts

Magento July 2021

Magento 2 Blog Extensions

While Magento isn't the go-to platform for blogs it can be useful for store owners to have a quick and easy way to post updated...
Magento April 2021

Notes: Magento 2 Directory Structure

## Magento 1 A brief reminder of the Magento 1 folder structure: * **app/code** followed by either * **/core** for core files * **/community** for...
Magento March 2021

Magento 2.4.2

The latest version of [Magento](/magento-ecommerce) has been released - Magento version 2.4.2 is the usual mix of security updates, performance and some improvements to the...

More MagentoSEO Posts...

Related SEO Posts

Notes SEO June 2019

Remove outdated content from Google Search Results

From time to time unwanted pages can appear in Google Search Results. Could be a temporary page, old content or even a test page that's...
Magento SEO November 2016

All-in-one Google Analytics tracking in Magento

Simple single script to add Google’s conversion tracking to your Magento ecommerce website. The code should be added into the footer.phtml file within your current template....
Magento SEO November 2016

All-in-one Facebook Pixel Code for Magento ecommerce

Simple single script to add Facebook’s Pixel Code tracking to your Magento ecommerce website. The code should be added into the head.phtml file within your...

More MagentoSEO Posts...