Google Tag Manager Basics #3: Your First Tag
This is the third of a series dedicated to introducing you, faithful reader, to the wonders and delights of Google Tag Manager. Last time, we took a high-level look at GTM and how it works, and today we’ll be looking at how to set up a simple tag.
We’re going to set up a Google Analytics pageview tag. This replaces the old hardcoded GA that you’d used to have to put on every page of the site. We start by going to tags and selecting the “New” button in the top-right.
The tag creation pane slides over, and we click into the Tag Configuration block there to open the tag template menu:
Select Universal Analytics from the list, because that’s the tag template we’re using here:
There’s the option to select between pageview, event, and some other track types but we’re going to stick with Pageview. Then we have to select what variable is going to contain our settings. There’s no settings variable yet, so we’re going to create a new one by selecting “New Variable” at the bottom there:
This highlights something quite important about GTM—you can do things in several different ways. If I’d thought ahead, I could’ve created my GA settings variable beforehand, but since I didn’t I can create it ‘on the fly’ while making my tag, without having to back out of the tag creation interface. Here, I’m going to add my tracking ID (not real) and give my variable a name. We’ll leave Cookie Domain set to auto
:
That’s all the configuration we need to do for this tag’s settings for the time being! All that remains is adding a name and a trigger. We add the name by editing the name field at the top, and the trigger by clicking the block at the bottom:
There’s only one built-in trigger in GTM, but fortunately that’s the one we want—All Pages; as this is replacing the GA code we’d put on all pages to fire:
Now we’re done, we just need to click the Save button in the top-right:
Now you’ve set up your first tag! Next time, we’ll be looking at testing the tag we’ve just implemented! If you have any questions, please get in touch 🙂