Why Should You Use Google Tag Manager?
Have you had experience setting up Google Analytics on a website in the past?
Remember how chaotic it could be, when you had more than 2 tags to put onto a site? Sometimes the scripts would create some sort of feedback loop, and you would have to find the problem.
Today, the best way to add (and manage) the code for Google Analytics (and every other tracking tag) is Google Tag Manager. It allows you to take your website data and sends it to other platforms like Facebook Analytics and Google Analytics. It also allows you to easily update and add tags to your code without having to manually write code on the back end.
Why should you be using Google Analytics?
In 2021, if you’re not using some type of analytics for your business or blog, then you’re not staying competitive.
If you have a product to sell, then you’re always looking for the best Audience to sell to. Or, If you set up a Call to Action to generate emails – yet you aren’t receiving any – you’ll want to know the answer why.
And this is where Google Analytics comes in.
Used by tens of millions of people, Google Analytics has a lot of small details. This can seem overwhelming at first. However, in the end it’s worth it, as it helps discover new insights that grow your business.
Targeting the right audience is a key to success, but being able to discover the right audience, is priceless.
By now I hope it’s obvious why you need Google Analytics(GA). Next, I will explain how GA works, and then I’ll cover the steps to setup Analytics on Google Tag Manager.
How does Google Analytics Work?
By default, it doesn’t track anything except when pages load. Which means any “non-pageview interactions” are not tracked unless you use “event tracking.”
Google Analytics is a great FREE tool to track visits and behavior! So let’s get Google Analytics set up!
How to set up Google Analytics?
1. Set up Google Tag Manager
First, set up a Google Tag Manager account.
Create your new account, typing out your Company Name and then your web address under Container Setup.
Note* You will not be able to set up any ‘/’ subdirectories, you must set this up on the primary domain. For example, if you have a website installed at Digitallythrive.com/blog, you must put in digitallythrive.com. The Google Tag Manager will be installed onto only the websites you want to track with GTM.
Next, accept the Agreements after reading through them, and you will be brought to a page that gives you your Google Tag Manager Code(s). The first code will be applied into the, and the second one serves as a backup, which will be applied to yourtags of your website.
For WordPress Sites
If you have a WordPress Site: Installing will depend on your theme. You should have a Child Theme set up (visit our article on how to setup a child theme), so if you do not, make sure you install one! The reason is, you will be editing your Themes header.php code, whenever it updates – you lose the codes you input.
You will find header.php in your file manager.
First, find which theme you are using. Under the WordPress dashboard, go to ‘Appearance -> Themes’. The very first one on the top-left should say ‘Activated’.
Now, jump to your websites directory in File Manager or FTP, where you can see the files like index.php, wp-config.php, and the folders such as wp-admin, wp-content, and wp-includes.
Jump into the wp-content folder, and then into Themes -> your websites Theme folder.
Copy the Google Tag Manager code. Again, make sure you have a child theme setup, and copy the header.php template into the child theme folder (just duplicate and move the copy over). Add the first part of the code at the bottom of the code, just before the “/head”.
The 2nd code will be added to the body, immediately AFTER that first body tag. After you have pasted this, make sure you check to see if it is working.
Go back to your Google Tag Manager Workspace, and make sure you submit your changes. Then Click Preview Mode to run a live bot though your site to check if you installed GTM correctly.
For WordPress using Divi Theme
If your WordPress site uses the Divi Theme, Divi makes it very simple, simply go to your Dashboard.
Scroll down to the bottom left, where you will see ‘Divi’. Click on Divi, then click ‘Theme Options’.
Find the tab on the top, named ‘Integration’. Paste the code into both the first and second sections. The part that reads ‘Add code to the < head > of your blog: paste the top part of the Google Tag Manager Code.
Directly under that, where it reads ‘Add code to the < body > of your blog: paste the second part of the Google Tag Manager Code. Simply save changes!
You are almost done! Make sure you actually publish changes, or you will not have activated your Google Tag Manager. This may lead to no tracking later on.
Once published, follow the next steps. You will create your Google Analytics account, and if you already have one, I will explain how to add your Tracking Code from Google Analytics to your Google Tag Manager.
2. Set up Google Analytics account
First, set up your Google Analytics account. Enter your account and website URL. Make sure you select the proper time zone to report in, as well as your Websites Industry Category.
Once you do that, accept all terms in order to get your Tracking ID.
This will be found at Admin (bottom left), once clicked you will see a section for Tracking Info. Under this you will see Tracking Code, click on that.
You will need this tracking information for Google Tag Manager, which has already been published to your site. The old, hardcoded way would have you copy/paste this code directly into your site, but now with Google Tag Manager, you can keep a variety of tracking scripts without having to keep adding code to your site.
3. Set up Google Analytics to work inside of Google Tag Manager
Now that you have set up both Google Tag Manager, and Google Analytics, you will learn how to set up specific Google Analytics tracking tags for your website.
Go to your Google Tag Manager Dashboard, and click on Add New Tag.
Click on Tag Configuration, and select Google Analytics: Universal Analytics.
Track type is already set to: Page Views. Under Google Analytics Settings, drop down and select ‘New Variable’.
Copy and Paste your Tracking ID from Google Analytics into this box, and save changes. Now your site will be tracking visitors live! Make sure you whitelist your IP address in your Google Analytics Account.
4. Publish your Workspace
Just a quick reminder that you need to publish your workspace, now that you have created it. Not doing so will lead to a loss of analytics, loss of tracking data, etc. If you think you have already published but are unsure, visit your site.
To publish your current workspace:
- Click Submit at the top right hand side of the screen. The Submit Changes screen will appear, with options to publish the container and save a version of your container.
- Select Publish and Create Version if it is not already selected.
- Review the Workspace Changes section to see if your configuration appears as you expect.
- Enter a Version Name and Version Description.
- If you have Tag Manager configured to use multiple environments, use the Publish to Environment section to select which environment you’d like to publish to.
- Click Publish.
When you are ready to check if it’s working, go to your Workspace Dashboard and click on Preview on top right. This will send live traffic through and tell you if Google Tag Manager is being recognized, as well as your Analytics.
That’s all there is to it! Now that you are finished, there is 1 step left to make sure you are tracking the correct data..
You need to exclude your work and home traffic from being collected by Google Analytics. I cover how to exclude your IP Address in Google Analytics in these 4 simple steps.