Setting Up Google Analytics in Google Tag Manager
The first thing to note in this article is that Google Tag Manager and Google Analytics are not the same thing. While they work very seamlessly together, they are two distinctively different programs. Google Analytics is an analytics program and Google Tag Manager, is a hub for all of your tags. With that understood, Google Tag Manager opens up a world of possibilities when integrated with Google Analytics and helps send the detailed information to these programs without having to be an expert coder or even having direct access to the source code of the website. In this article we will walk through how to implement Google Analytics through Google Tag Manager from scratch. (Note: If you are just getting started with GTM, we suggest you read Getting Started with Google Tag Manager first before reading this post)
Setting Up Google Analytics in Google Tag Manager
The benefits of running Google Analytics through Google Tag Manager doesn’t just have to do with organization: advance set-ups of GA through GTM can allow you to track almost any site interaction you’d like to, from a click on a button to advanced scroll tracking. This is why an optimized setup of Google Analytics early will help streamline advanced tracking capabilities later. In this section, we will be reviewing how to push Google Analytics through Google Tag Manager and best practices.
Create a Universal Analytics Tag
Now that you have your Universal Analytics – Tracking ID as a constant, we can create our first Tag. Navigate to the Tag section of your GTM dashboard and select New.
Name your tag something easy to remember and also something that distinguishes it from other Google Analytics tags that you might create down the road. My suggestion would be “Universal Analytics – Main” or “Google Analytics – Pageview.” Google Tag Manager provides a few tag interfaces to help you get started: Google Analytics is among the tag templates, so select the GA button.The first option it gives you is to select between Universal Analytics and Classic Google Analytics. Most likely, if this is going on a new site and you’ve never had GA before, you are going to want to select Universal Analytics. The only time you’d select Google Analytics is if your site already uses old Google Analytics; however, Google has rumored that they will be removing this option from GTM moving forward. If you have a UA-XXXXXXXX-X Tracking ID, you are on Universal Analytics.Now we need to configure the tag. Click the little lego piece next to Tracking ID. This lego piece represents your variables, and any new variable that has been created will show up in this dropdown. Find your tracking ID constant variable that you created and select it. (If you haven’t created a UA Tracking ID constant, see our post Getting Started with Google Tag Manager).
Now we can add a few custom features that will allow for some advanced and interesting data. After putting in the Tracking ID variable, select the little checkbox underneath called Enable Display Advertising Features. This will allow you to get demographic data in your Google Analytics reports.
*note: You will still need to enable this feature in Google Analytics itself by going into your Property Setting under Tracking Info, selecting Data Collection and clicking on the button that is next to Advertising Features.Click Continue and that will prompt you to pick a trigger for this. A trigger is essentially a list of rules that determine when your tag fires. Since, Google Analytics should be placed on every page of your site, select the Fire On “All Pages” trigger and then “Create Tag.”
You have now created your Google Analytics Tag! Note that nothing will fire though until you click Publish.
Preview/Debugging and Publishing your Tag
Before publishing your tag it’s best to use the preview and debugger or the Tag Assistant to make sure everything is firing properly.Preview and Debug will become essential as you create more and more tags, however, for the sake of wrapping up this tutorial, we will assume that everything is input correctly and will click Publish. Feel free to comment below or contact us with questions on how to use the Preview and Debug mode.When you click Publish, it should look like this. After verifying that everything looks ok, name your container version with a description of what you just did and click Publish Now.
Now if you enable Tag Assistant (by Google), you should see both, your GTM Tag and your Google Analytics tag listed. Google Tag Assistant still has bugs in the newest version and has not updated itself to reflect the new GTM changes. Therefore you may see some errors that you can ignore.
Invalid or missing account ID error is because the new GTM account ID’s have 7 letters/numbers and the extension is looking for only 6. You can ignore this error.GTM changed its implementation standard a little while ago, we now place part of the code in thetag. GTM tag assistant is looking for it in theand therefore you will get this error as well.If you are aware of these bugs, Tag assistant is still a great asset for you to use to debug your tags. Hopefully, they will fix these bugs soon, or we’ll build something better!One more quick verification technique is very useful to make sure everything is in the right place. Go back into your Google Analytics interface and select Real Time. If you are currently on your site, you should see some at least 1 user. Jump around your site a bit to verify that it’s picking up traffic.
If everything looks good, you are done! You’ve implemented Google Analytics through Google Tag Manager. We are really just scratching the surface of what can be done with an advanced setup of Google Analytics through Google Tag Manager, but it’s a great start. Now go play around but careful: with great power comes great responsibility. Google Tag Manager can quickly break your website if you don’t know what you’re doing, so make sure you research hard, step carefully, and don’t be afraid to ask! Contact or comment with any questions you may have. Good Luck!
About Great Big Digital
Achieve your website goals with customized data, intuitive UX, and intentional design.