Upgrade to Google’s Universal Analytics using Google Tag Manager
Well Google’s Universal Analytics is more than a year old! With all the new features – demographics, cross device tracking (User ID), enhanced link attribution, sub-domain tracking by default, easier cross domain tracking, enhanced ecommerce, more control from the admin panel… You would think every one would have upgraded by now – right
Well in the classes I teach and the clients I work with it is clear there are a lot of websites that are due for this upgrade. This post will show you the step by step processes for upgrading to Universal Analytics. You will also upgrade your website to Google Tag Manger at the same time (you will thank me later…).
So let’s dive in:
(Important note – this post assumes you are using the standard Google Analytics code on each page of your website. If you are using more advanced implementations – such as ecommerce tracking, tracking events… Read follow on posts that will describe how to include this tracking as well.)
Step 1 – Create a Google Tag Manager Account and Container
Open up the website for Google Tag Manager – tagmanager.google.com. If you have a Google Account sign in with this account and then you will see this screen:
And on the Account page create a new Account. Give it the name of your Organization and then hit the ‘Next” button.
On this page enter in a name for your Container – it should reflect the name of your website. Enter in the domain name and pick the time zone for your reporting. (If you have multiple websites – best practice is to have a container for each.)
This will show you the code that will be added to your website (we’ll come back to this).
Step 2 – Obtain your Tracking Code
Before we create a Tag in Google Tag Manager we will need your analytics tracking code – so open up Google Analytics in another browser and navigate to the “Admin -> Web Property Settings” to see the Tracking Code – it will look like “UA-XXXXXX-YY’ (it may have a different number of digits in the ‘X’ part – don’t worry about that – really don’t worry…)
While you are in the Property Settings – turn on these three items “Enable Advertising Features”, “Enable Demographics and Interest Reports” and “Use enhanced link attribution” – these are two of the new Universal Analytics Features.
Copy your Tracking Code and go back to Google Tag Manager.
Step 3 – Create a Universal Analytics Tracking Tag
In Google Tag Manager click on the ‘New Tag’ link. On this page give your tag a name – something like “Universal Pageview” would be nice and click on the Google Analytics button, then click on Universal Analytics and the blue Continue button.
On this next page – paste in the Tracking Code into the Tracking ID field and click on ‘Enable Display Advertising Features’. Open up the ‘Advanced Configuration’ and change ‘Enable Enhanced Link Attribution’ from False to True. Once complete – hit the “Continue” button.On the next page click on the “All Pages” button in the “Fire On” area and then click on “Create Tag” – we’re almost almost home.
The tag is now created, the last thing we need to do is publish the container – do this by hitting the red ‘Publish’ button in the upper right hand corner. And then click on the blue ‘GTM-XXXX’ link in the upper left hand corner to see the container code.
Copy this code and get ready to paste into your website. (Depending on how your website is setup, you may need help from a developer – go ahead and bring them on-board…)
If you are using WordPress consider using this plugin: https://wordpress.org/plugins/duracelltomi-google-tag-manager/
Or for Joomla (from your truly) – http://toolsforjoomla.com/index.php/component/ars/repository/googletagmanager?Itemid=109
Step 4 – Replace your Analytics Code with your New Container Code
To complete the upgrade we will replace the old Google Analytics code and put in our new container code. Open up your website and find the location of your Google Analytics code – it could be in an index file, a header file or some other common file in your website. The current Google Analytics code will look something like this:
var _gaq = _gaq || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
Delete this code from your website. Paste the container code just below the “<body>” tag. Save this to your website. Open up your website and with Google Tag Assistant (a Chrome plugin) you should see the following:
If you do not see the Google Analytics and Google Tag Manager code in Tag Assistant – double check that your Container Code was copied exactly from Tag Manager. make sure that it is placed below the “<body>” tag and finally that there are no extra tags around it – for example two “<script>” tags.
If you see two Google Analytics lines with the same tracking code – double check that the old Google Analytics code has been removed.
If you have any other questions – add them in the comments section.
Everything is Working!
That’s that – now you have Universal Analytics running on your website using Google Tag Manager. Congratulations!
More About Universal Analytics
Google’s official documentation on Universal Analytics – https://support.google.com/analytics/answer/2790010?hl=en
And when you are ready to really learn how Universal Analytics can expand your understanding:
If the new features in Universal Analytics did not convince you to update; read about more advanced features in Universal Analytics at this blog post from Avinash Kaushik – http://www.kaushik.net/avinash/universal-analytics-implementation-tips-strategy-tactics/.
A blog entry from Justin Cutroni on the ability of Universal Analytics to track well beyond your website: