In the last couple of posts, Zip installed Google Analytics with a plugin. However, he then saw this newfangled thing (as there always is) called Google Analytics 4 in his Analytics account. He couldn’t resist; he pushed the button and enabled it.
While he’s at it, he might as well install Google Tag Manager. Quite a long time back, I used Monster Insights’ paid version. It’s a good plugin and easy to configure. Still, I found some things that it would not track. Then I found that I could do those things and more — without paying for an expensive plugin –by using Google Tag Manager.
Yes, it took some additional work setting up all the tags. However, Tag Manager offers much in the way of flexibility if you want to track custom tags. Does Zip need to set that up right now? Probably not. At this point, he’s only interested in tracking page views. Still, let’s get it out of the way and set it up now.
How to Install Google Tag Manager
Note to sloth: remember to disable any tracking codes or analytics plugins you have on your site that might result in double tracking
AND How to Set Up Pageview Tags in Google Tag Manager
Time needed: 30 minutes.
How to Install Google Tag Manager
- Go to Google Tag Manager
You’ll find it at https://tagmanager.google.com/#/home. You’ll need a Google account — but Zip already has Google Analytics, so, of course, he already has this.
- Click “Create Account”
On the Google Tag Manager homepage, you’ll see a button in the upper right-hand corner inviting you to “create an account.” Create an account (of course, if you already have one and need to add a new site, you can create a new “container” in the same account by clicking on the three dots and choosing “Create Container.”
- Create an Account
After you click the button, you’ll see the page where you can create an account. Choose account name (for instance, the name of your company or your blog), enter a name for your container (this will be where all your tags live), and we’re creating a web container, so we’ll choose “Web.” Click “Create” and move on.
- Accept the Terms of Service
You’ll see a popup with the Google Terms of Service agreement. If you accept them, choose “yes” and move on. If no, you can stop right here.
- Your Google Tag Manager code, sir or madam!
You’ll get a popup with your shiny new Google Tag Manager code telling you to install it in the <head> of your website, and another code in the <body> section. If you don’t copy it right away, not to worry: You can always find it by clicking Admin and then “Install Google Tag Manager” from your tag manager account.
But how to install this?
Zip needs to put it in the code of his website so it will be enabled on every page. Many themes, particularly premium ones, will have an area specifically for inserting codes like this. But he’s using a free theme right now and it doesn’t seem to offer this.
That’s OK, we can add this ability. If you install a plugin like Insert Headers and Footers, you can easily insert the tracking scripts.
After Zip installs the plugin, he can find it under settings and then put the codes in and save.
- Notice Variables, Triggers. and Tags
You’ll notice in your Tag Manager account three critical things: Tags, Triggers, and Variables.
A variable is reusable. We’ll be setting up variables here for our Universal Analytics and GA4 codes.
A trigger “triggers” the tag to fire on a page. For instance, a pageview is one type of trigger and the one we’ll use there.
A Tag is what fires on the page.
You can add tags for everything from tracking videos to how far someone scrolls down on a page to e-commerce. But, for today, we’re going to set up pageview tracking.
- Add your Universal Analytics tracking ID
Skip this if you’re only setting up GA4.
Click on “Variables” on the left side of the screen. On the next page, click “new’ under “user-defined variables.”
In the pop-up — give your variable a unique name. We’ll call this one “Universal Analytics.” Click on “Choose a Variable Type to Begin Setup,” and choose the “Google Analytics Settings” variable.
You’ll see a space to insert your analytics tracking ID. This is the one you can find in your Analytics account as described in this post — the one that starts with UA.
Insert the code and press “Save.”
- Set up an Analytics Tag
OK, let’s set up a tag to track page views in Universal Analytics
Click “Tags” on the left of your screen. Click “New,” and give your tag a name that will let you know what it is.
Click “Choose a tag type to begin setup,” and choose the “Google Analytics: Universal Analytics” option. Under “Google Analytics Settings,” you’ll see a drop-down where you can choose the variable you just created with your tracking code. Choose that.
Under “Triggering” choose “choose a trigger to make this tag fire. Click that, and choose “All Pages.” It will look something like the picture below. Click “Save.”
- Set up Google Analytics 4 Pageviews
Skip this if you’re only using Universal Analytics.
You set up GA4 pretty much the same way as you do UA. If you look for a variable specific to GA4, you won’t find it. However, you can set one up using the “Constant” variable and entering your GA4 tracking code. Or you can just enter it directly in the box for the tracking code in your tag.
Set up your tag just as you did with Universal Analytics, except this time choose the Google Analytics: GA4 tag configuration. Choose the pageviews trigger, again, and save.
- Submit Your New Workspace
Eventually, Zip will have many more tags here. But, for now, he’s just installing pageview tracking.
Whenever you make changes to your Google Tag Manager workspace, you need to submit the new changes — otherwise, they won’t reflect on your website. Click the blue “Submit” button in the upper right-hand corner.
Then, on the next screen, give your version a name and a description and click “Publish.” Remember to do this anytime you come back and add, remove, or revise tags. It will say, “Sing like no one is listening!” and Voila, your container is published!
Again, remember to remove any plugins your have on your website that may be installing the same tracking IDs.
Is Your Tag Working?
Go visit your site in a different browser, or from your phone. Go to your Google Analytics page and check both your UA and GA4 stats (or whichever you’re using).
You may not see activity in GA4 right away. If not, check back in 24 hours.
There are a couple of other ways to check if your tags are firing:
In Tag Manager, if you click “Preview” — located right next to “Submit” –you can run a test to see if your tags are firing.
In Chrome, you can add the Google Tag Assistant extension. It will analyze which tags are firing on any page if you open it. It’s a good tool if you suspect something isn’t working. Go to More Tools>Extensions in Chrome and look for Tag Assitant. You’ll see the happy little tag in your browser, and you can click it if you think something’s amiss.
We’ve learned how to install Google Tag Manager. What’s Next?
Next, we’ll (likely) take a look at setting up Google Search Console. Zip can, then, see how visitors are finding his website. Search Console will also help, in the future, ascertain if there may be errors on his website. Errors that might be affecting his performance in search1.
We are sorry that you found this post to be like a weak cup of decaf.
Let us improve this post!
Tell us how we can improve this post?
- Though, he wonders, how many people really want to read a blog that’s all sloth. Don’t be discouraged and give up now!