Do you want to implement Google Analytics via Google Tag Manager, but you lack the (technical) skills required? No worries, I have written this 20 steps guide to help you out.
Google Tag Manager can be daunting at first. Tags, triggers, variables… yeah, I hear you thinking. After reading this guide you know exactly where to start.
I was inspired to write this post by LunaMetrics, one of the top Analytics agencies in the world.
In this step-by-step tutorial I will explain in detail how you can set up the GTM basics in record time. I will use my “Marathon Training” website as an example here.
Step 1: Set up Google Tag Manager Account
I recommend you to use your Google Analytics account login for setting up your Google Tag Manager account.
Log in to your Google (Analytics) account and navigate to this URL.
Step 2a: Setup Account
Fill in your Account Name and it’s up to you whether you like to share data anonymously with Google or not.
Step 2b: Setup Container
Fill in your Container name and select web (if you own a website like me). You can change the name settings later if you make a mistake here.
Step 3: Accept GTM Terms of Service Agreement
Read through the service agreement and accept the terms and conditions.
Step 4: Install Google Tag Manager
Copy the code below and paste it onto every page of your website. Preferably immediately after the opening <body> tag.
Read this quick start guide if you have problems with installing the code.
Step 5: Review Your Account
After you have hit “OK” you will land on this page:
You just have created one account with one empty container. In order to get things rolling, you need to manually set up tags, triggers and variables, or…
Yes, there is a great solution. You can important a predefined container from our friends at LunaMetrics (!).
Step 6: Navigate to Bounteous.com
Bounteous has done a tremendous job by providing this GA Complete Pack for GTM.
The GA Complete Pack includes recipes to help setup and enhance your Google Analytics implementation, including some of their more advanced plugins.
- Basic Pageview Tracking
- File Download Tracking
- Contact Link Click Tracking
- Outbound Link Click Tracking
- YouTube Tracking
- Scroll Tracking
- Cookie Management Tools
- AJAX Listener
Step 7: Download GTM Container
In the top right section of the page is a “Download Container” link:Make sure to save it (JSON file) on your computer.
Step 8: Navigate to Admin Section of GTM Account
Now it’s time to import the container in GTM.
First you need to go to the admin section of your GTM account.
Step 9: Click on “Import Container” Link
Step 10: Upload JSON File
You can now upload the JSON file (luna-advanced.json) into your GTM account.
Step 11: Preview and Confirm Import
Before the container is imported in Google Tag Manager, you need to preview and confirm the upload.
Step 12: Review Container
Take a look at “Recent Activity” to confirm the import has succeeded:
The imported file helps you to easily measure core interactions in Google Analytics.
Step 13: Create a GTM (Test) Property in Google Analytics
I recommend to set up a temporary new property in Google Analytics first instead of simply removing your current Google Analytics script.
It doesn’t matter whether you have already deployed Classic or Universal Analytics. You simply don’t want to mess things up!
By doing this you can:
- Test whether your GTM set up works correctly
- Compare the data of the two properties
Simply click on “Create new property” link and you can easily set up your Google Analytics 4 test property:
You are allowed to create 50 properties in one account. In this case it is my second property and reads “UA-XXXXXXXX-2.
Step 14: Change Variable in GTM
There is one variable in GTM that you need to change to get this to work. It’s a user-defined variable.
You can find it in the variables list, named: YOUR_GA_TRACKING_ID.
Change “UA-XXXXXX-YY” into the tracking id of your new created property.
Step 15: Preview Container
In the “Versions” section click on “Preview” latest version (probably version 2).
Step 16: Refresh Your Website
Yeah, a lots of tags are fired on this page. It looks good!
Step 17: Publish Container
It’s time to publish the container if everything looks good.
Step 1:
Step 2:Make sure to leave preview mode in the container section.
Step 18: Use Real-Time Analytics for Final Check
I have just visited this page: http://www.marathon-training-tips.com/marathon-training-schedule.html.
Let’s check Google Analytics now:
Note: make sure not to exclude your IP address in the GTM test property/view if you want to verify your data with real-time reports in Google Analytics.
Helpful guides:
Step 19: Compare Data of Both Properties
From now on you have your “old” property (UA-XXXXXXXX-1) collecting data and your fresh, new GTM property (UA-XXXXXXXX-2) collecting data as well.
I recommend to wait a few days to see your data coming in properly.
The numbers might deviate a bit, that’s normal!
Step 20: Change Tracking ID in GTM
Let’s assume you are satisfied with everything.
There are two last things you need to do:
- Change UA number “-2” to “-1” in Google Tag Manager (please see step 14).
- Remove your current hardcoded script(s).
You made it, congratulations!
Bonus
In the beginning of this article I mentioned all the great stuff this plugin can do for you. A short recap:
- Basic Pageview Tracking
- File Download Tracking
- Contact Link Click Tracking
- Outbound Link Click Tracking
- YouTube Tracking
- Scrolltracking
You might want to set up a few new goals that are in line with your business and the (probably) new things you are measuring now.
Note: this is not a complete Google Tag Manager installation. There might be a few things you need to track additionally. It just gives you a head start!
Well, this is it for now. I hope this guide helps you to implement Google Analytics and Google Tag Manager in a smart way!
Of course there are many more things you can do with Google Tag Manager. But that is something for another time!
Do you already use Google Tag Manager and are you happy with it? Not yet using it, but inspired to consider switching to GTM? I am happy to hear your thoughts!
One last thing... Make sure to get my automated Google Analytics 4 Audit Tool. It contains 30 key health checks on the GA4 Setup.
Miroslav Pecka says
This is great setup pack. I used similar for my websites
and I use regular expression that covers 132 the most common file extensions.
If you want you can copy my list of extension at http://miroslavpecka.com/gtm-ga-events-download-and-outgoing-link/ to be used in file link click trigger.
Paul Koks says
Hi Miroslav,
Thank you for your comment and I will check out your link. Sounds very handy!
Paul
Nick Nemethy says
Hi Paul,
Great post! I manage all my tags through GTM including GA, and recently found out that social plugin data (like social shares) are not sent to GA when using plugins like AddThis if GA is implemented via GTM (because the ga() function isn’t available on the page). I was advised by another DA friend to implement it using a custom html tag template instead of the Google Analytics template Tag Manager provides. Would you advise this or could this potentially cause issues?
Cheers,
Nick
Paul Koks says
Hi Nick,
Good to hear from you! To be honest, social shares are not always easy/accurate to track. Since you need to have a callback function if you simply don’t want to rely on the initial click (which is not accurate). I recommend to look into the most popular networks individually and go from there. They usually give you information on how to implement it. Custom html tags are a great way to go and shouldn’t cause issues if implemented correctly.
And last but not least, I have picked up really great ideas through the advanced courses on GTM from Measureschool. Social tracking is one of the topics discussed.
Bet,
Paul
Nick Nemethy says
Thanks Paul! Really appreciate your advice. Going to take your recommendation and look at each network individually to see about implementing share buttons that way.
Cheers,
Nick
Paul Koks says
Sure, you’re welcome Nick! Just try to find the most optimal way and maybe on some social networks you need to settle for only measuring the button clicks. This in case you can’t implement a callback function. Best, Paul
Honoree Tigrett says
I wondering if there’s a way to check your competitors’ ga setup (something akin to semrushs view of competitors AdWords ads). I’m working on a new niche and have to setup ga and gtm from scratch and need to decide on what to measure, track, etc. It’d be so much faster and less error prone if I could *see* setup. Of course as a guide: just as no one (hopefully) copies Ads word for word, nor has the same exact tracking/measuring needs. AdWords and G Search will be integrated with GTM.
One question I have: is their a chart or printable that has all the different custom variables for individual niches. I know GA asks what category of business you fall under, but it’s not to give you a tip page full of typical setup, general tracking, etc. thank you and I love all the guides and checklists you post for free.
Paul Koks says
Hi Honoree,
Thank you for your comment! Unfortunately there is no way to really spy on your competitor’s GA setup. The configuration is completely invisible. However, you could learn something about the implementation by investigating which custom dimensions, metrics, events etc. are triggered. You could use different debugging tools for that.
As far as I know there is no list that contains this custom dimension (variables) overview per niche. I usually compile a list by an in-depth examination of a client, website and their measurements needs. This is really unique per company. Of course you will see some overlap over time, but it is never the same.
Best,
Paul
Vipul says
Hi,
I have to implement GA using GTM for my company and a single reporting suite is going to contain data from web, mobile site and app. How can I go about getting all three platforms’ data in a single property?
Thanks,
Vipul
Paul Koks says
Hi Vipul,
You don’t want to mix app and website data. So I recommend to set up at least two properties: one for web/mobile and one for the app.
Regarding app tracking, I recommend to check out LunaMetrics’ blog:
http://www.lunametrics.com/blog/2017/04/11/firebase-hybrid-app-tracking/
http://www.lunametrics.com/blog/2016/10/18/firebase-analytics-for-apps/
Best,
Paul
Michael Moore says
Hi Paul, any tips for e-commerce tracking? We have all that GA data hardcoded on our confirmation page. Is there a guide to migrate that to GTM?
Paul Koks says
Hi Michael,
To be honest, as the ecommerce implementation differs quote a lot, it’s very hard to find a precise guide. Have you tried the support pages of Google Analytics? I would recommend to do some searches on “google tag manager enhanced ecommerce” to find an article that matches. Set up a separate property first for ecommerce testing and migrate after. Best, Paul
Roger says
Hi Paul,
When you say create new property and name it – 2, are you suggesting to use same domain? or implement GTM in another domain? That point is confusing and is most important. Please add little more clarity. Thanks.
Paul Koks says
Hi Roger,
You want to create a new property for the same domain and implement GTM there.
For example:
– Hardcoded – 123456789-1
– GTM – 123456789-2
After you have gathered enough data in the GTM property (same website) and the data matches with the old property (not exactly, but not too big differences), you can switch the Google Analytics variable in GTM to 123456789-1 so that the data flows in the original property. Further, you can move any hardcoded tracking (that is replaced) then as well.
Hope this helps!
Paul
Ian Oates says
Hi Paul,
Just found this article yesterday and it’s been such an enormous help. Thank you very, very much for putting it together.
I’m not sure, however, I understand what you mean when you talk about “hardcoded scripts”. Can you please explain? I’ve only got one personally created GTM tag and the ones I downloaded from LunaMetrics.
All the best,
Bow
Paul Koks says
Thanks for the heads up Bow! :-)
Hardcoded refers to embedding scripts directly on the website instead of implementing them via a tag management solution, e.g. GTM.
It sounds like you have set (most of) the scripts via GTM which is more efficient in the long run and less error-prone.
david says
Hi Paul,
Thanks for valuable information, y have a problem with the url in the step 6, looks like doesn’t found.
Paul Koks says
Hi David,
Thank you for the heads up – I have updated the link. It should work now!
Best,
Paul