Using Google Tag Manager for Google Analytics
Always one to want to try out new things, I have been toying with the idea of using Google Tag Manager for a few weeks now. There have been a few deadlines however and I have been postponed in my investigations and subsequent playtime. That all changed today.
I had been asked to do some work for a family member and whilst I could get away with adding a the GA code into the <head> tag as is usual, I thought I would use this as an opportunity to play with the Google Tag Manager.
I logged into the Google account that is associated to the website, and I added GA and I then went on to add GTM. Exciting stuff? Maybe not enthralling, but something new to be sure.
So having added GTM to the Google account I then went into the GTM control panel.
I added a new account, name set at the domain name
I added a new container, container name set to the domain name also.
Google then displays their Google Tag Manager Use Policy for acceptance
I received an erroneous message when I accepted this:
I ignored it and moved on, like the hardened professional that I am.
The container code is generated and displayed.
This will need to be copied after the opening <body> tag of the website pages for which it will be used. Using WordPress, this will most often mean altering the header.php file of the theme being used, and in Joomla this will most likely be a modification of the template folder index.php file.
I was then given the option to add a tag from a default set of commonly used and available tags.
From the available selection I chose Google Analytics, having created my GA account prior to this.
I added a tag, and provided the following information:
Name: Google Analytics
Tag Type: Google Analytics
Web Property ID: UA-xxxxxxx-x (please replace x’s with GA account UA id)
I left Add Display Advertiser Support unchecked.
Track Type: Page View
These settings were saved. It was unlikely that I was going to get better than that.
I then clicked on the button labelled ‘Add Rule to Fire Tag’:
The existing rule was probably fine, but I went out on a limb and clicked on the Create new rule radio button, the following expansion of the window occurred (please note that I show the completed form here). The value in the textfield is the domain name for the URL that the Google Analytics code is to be associated to.
I then clicked save. This returned me to the Add New Tag page with the rule added
With all set up and ready to roll, we can now save it all, and see how we have done according to the kind people at Google World.
A summary screen is then provided to allow us to view all the details that I’ve provided.
It can be seen that 2 rules apply; the original RegEx and the one that I added labelled as Google Analytics. At the top it is also seen that this has a status of ‘unpublished’.
Select the Version – Overview, from the left hand menu. This will open up a new set of details in the main area on the page.
From here select to create a new version by clicking on the button on the right of the page.
Then click Save and Preview. This will generate a new version of the container and allow you to see if all the modifications that you have made are working as expected by providing a preview of the page.
A link to the website is provided for a preview to be made of the website. It can be seen from the window which version of the website this is (Version 2).
The website will open when the link is clicked, and at the bottom of the screen an output of whether the tag fired.
It can be seen here that it has been a success! Time to break open the bubbly and get on with something else productive!
I hope that has been helpful, but if you have any questions do not hesitate to let me know.
Have a great day!
* For more information and our gratitude for the header image, visit http://analytics.blogspot.co.uk/2012/10/google-tag-manager.html
For more information on this and other Google products provided in easy to digest video formats have a look at: http://www.google.com/ads/experienced/webinars.html