We have touched on Google Tag Manager and the powers it withholds in previous blogs, but lets now use a real-life example on how to implement a UA tag to fire in GTM.
Wait, UA and GTM?? UA is Universal Analytics, it is basically your Google Analytics Tag that makes tracking possible, and GTM is Google Tag Manager.
First off, implement GTM on your website, this will have to be coded and most likely implemented via a developer. To find the code follow the below steps
1. Go to your GTM account
2. Navigate to ‘Admin’ in the top navbar
3. Click on ‘Install ‘Google Tag Manager’
4. You will find 2 pieces of code, one should be implemented in the as high in the <head> of the page as possible and the other immediately after the opening <body> tag
5. Implement in the codebase and test, a simple way to test is to use the live preview function in GTM to verify the script is there and working which you do by clicking ‘Preview’ in the top navbar and navigating to your website
Congratulations, you have successfully implemented GTM on your website, the possibilities are now endless, however, you have no tags set up yet, so lets set up the most crucial tag, Google Analytics.
1. Find your Google Analytics code, by navigating to the Google Analytics dashboard and click on ‘Admin’ in the bottom nav
2. In the Admin menu, find ‘Tracking Info’ under the property and click on it
3. In the ‘Tracking Info’ menu you will see a sub item called ‘Tracking Code’, click on this
4. This will display your Tracking ID which looks something like UA-000000000-1 copy this code as it will be needed in the next step
We are now making a tag, for a tag to successfully work you need 2 things - a tag and a trigger, lets set both of these up now
1. Navigate back to Google Tag Manager and click on ‘Tags’
2. In the top nav you will see a CTA called ‘New’ click on this to add a new tag
3. We are now setting up a tag, first thing to do is name your tag, naming conventions are up to you and your business, but be mindfull that when you have hundreds of tags you want something memorable and easy to identify, for this certain tag i recommend naming it ‘Universal Analytics’
4. Next step is to set your tag, remember the tracking ID we got from Google Analytics, this is where you will need that, click on ‘Tag Configuration’ on the left you will see some built in tag options, select ‘Google Analytics: Universal Analytics’
5. You will now be presented with some more options as shown below, for this certain tag lets set out ‘Track Type’ to Pageview (this means we are tracking how many page views we have)
6. Now lets set our Google Analytics Settings - this is where you need to tracking ID. Click on the menu and select ‘New Variable’
7. Here we need to Name our Variable and set our Tracking ID - lets name the variable something easy to identify - ‘Universal Analytics Variable’ then number we got from Google Analytics, paste that into the Tracking ID field and click Save - we now have a UA Variable set up which we can use in tags right across the site
8. Now we need to trigger this tag to fire, to do this click on the Triggering box
9. From default GTM has one trigger set up which is All Pages - this is what we want to select for our UA tag, this means this tag will fire on every page across the site
10. We now have a tag and a trigger, lets click ‘Save’ and start testing
We have set up GTM on our site, added a tag and a trigger and now we need to make sure we have tested before we can deploy the GTM container, so how do we do this?
1. In the top nav bar click on ‘Preview’ and you will be presented with a notification that you are now in preview mode
2. Navigate to your website and you should see a Tag Manager preview at the bottom of your screen, if set up correctly, you should also see you Universal Analytics Tag there and should see how many times it fired, have a click around the site and make sure on each page that tag is there and only fires once per page
So we now have our Google Analytics tag set up and tested on our website so that we can track all data within Google Analytics. But we have one more step, we need to deploy the GTM container, to do this;
1. Navigate back to the overview screen in the GTM dashboard
2. In the top nav bar click on ‘Submit’
3. Write a descriptive name so that you can identify what you deployed in this version in case you need to go back to this someday
4. Click on ’Publish’
5. You have now submitted your Universal Analytics tag to the site and data will be feeding into Google Analytics, however, let’s just do a final check to be 100% confident
6. Navigate to your website and you should see a Tag Manager preview at the bottom of your screen, if set up correctly, you should also see you Universal Analytics Tag there and should see how many times it fired, have a click around the site and make sure on each page that tag is there and only fires once per page
7. Congratulations, you have set up your first tag in GTM!
One thing to note is that this is the best method to set up analytics on your site for ease of use and also allows an easy way to set events, for peace of mind, do not set up your Analytics tag via code as well as this way to avoid any possible double tracking.
Note: i am not responsible for any mistakes made while implementing, this is the responsibility of the person setting up the GTM code and tags.