Google Tag Manager to a WordPress website. I’m Tommy Griffith with ClickMinded.com. Let’s get going. Okay.We’re gonna jump into the ClickMinded SOPLibrary for this one. SOP stands for “standard operating procedure.” It’s just a fancy way to say a really comprehensive checklist. We have a huge number of digital marketingSOPs on our website at ClickMinded.com. Adding GTM to a WordPress website, this will only take about five to 10 minutes to do. Let’s do a quick, high-level overview of everything we’re gonna do right now. What’s the goal here? The goal is to add Google Tag Manager to aWordPress website. The ideal outcome is that Google Tag Manager is properly installed and there’s no technical issues. The prerequisites here is that this is only applicable to WordPress.org installations, so anything on WordPress.com is not going to work, but if you’ve installed WordPress onto your own domain, you should be fine. Why is this important? Google Tag Manager is the single place that you should be putting all of your tracking pixels, as an internet marketer, because they’re very, very advantageous things to do. Where is this done? This will be done in both your WordPress back-in and in Google Tag Manager. When is this done? Only once. This is a huge advantage of this. You only have to install Google Tag Managerone time, and then you’re set going forward. Then who does this? This will be anyone managing your website,anyone managing analytics, anyone running maybe paid campaigns, or maybe it’s you. Okay.
Google Tag Manager on a WordPress Site
Let’s talk about environment setup next, to get this going. First and foremost, you need the Google TagAssistant Chrome Extension. We have a link to that down below if you want to grab it. This is a very helpful tool, not just forGoogle Tag Manager installations, but any kind of tracking, Google-based tracking that you want to validate. This is a very helpful tool, so we’re going to install that. You also need to sign up for Google Tag Managerif you have not already, so make sure to grab that. If this is your first time creating a GoogleTag Manager account, you’ll be prompted to set one up. For now, you can just use your company website and the company name for both the account and the container, right? Okay.
Go ahead and enter your account name, or demo site, or demo testing ground. Click Minded is A Site About Emojis. It’s literally called ASiteAboutEmojis.com. That’s going to be our account name. “A Site About Emojis” will be our account name in the US. We’ll hit continue, and our container name will be the website, “ASiteAboutEmojis.com.” We’re going to use the container on the web,and click “create.” “English.” We’re gonna accept the data processing terms. You can read through this if you want, and sign your life away to Google. There we go. Now, Google Tag Manager has been set up, and the first thing they do is they give us the code, right? Copy the code and paste it into every page of your website. A couple things going on here. First they ask you to take this code and paste it as high in the head of the page as possible. We’ll talk about what that means in a little bit, and then second, we take another snippet of code, and we paste that immediately after the opening body tag, right?
If you’re hand-coding or hand-designing your site, and you want to paste the code in here, you can, but we actually don’t recommend this. Especially if you’re doing a WordPress installation,there’s a way easier way to do this. I just kind of wanted to show you the screen that shows up when you first set up the Google Tag Manager account, so you can just click”okay” for now and not actually copy any of the code. There’s a way easier way to do this. I’m going to hit “okay.” The first thing you’ll notice when you get in here is your Google Tag Manager ID up top. You’re going to want to make a note of that. We’ll need that later, so go ahead and right click it and just copy that, so that you have that on your paste. That is there. The way to think about Google Tag ManagerWorkspace is it’s this little container that we’re gonna insert into our website one time,and a request is gonna be made. Every time that webpage is loaded, a request is gonna be made to this Google Tag Manager container space, and any of the pixels that are in it are gonna fire. What that means is that allows us to add and remove tags from here, instead of having to push new code to our website.
If you don’t understand the details, that’s fine. All you need to do next is go up to the top right-hand corner, and click “submit.” What we’re gonna do here is we’re gonna push the Google Tag Manager container live. There’s nothing in it yet, but we’re just gonna push it live to get this going. In the future, you might be writing versions names and version descriptions, and you might get really heavy with it. You don’t need to now, so just go ahead and come up top and click “publish.” Again, you can skip the description, and justclick “continue,” and there you go. We are now living with our container. Cool. We’ve set up a Google Tag Manager account,we published our first container. Now we’re going to go back into WordPressand set it all up. Head over to your WordPress dashboard, goover to plugins, and click “Add New.” We’re gonna add a new Google Tag Manager plugin to WordPress. You can come up here to the top right-handside, under “keyword,” and just search for “Google Tag Manager.” Now, there’s a lot of different options here.
There’s plenty that work. I think the easiest one and the one we’re going to show you today is usually the first one that shows up. It’s called “DuracellTomi.” “DuracellTomi’s Google Tag Manager for WordPress.” It looks like this. The author might change the icon from time to time, but look for DuracellTomi’s Google Tag Manager for WordPress, and go ahead and click “install now.” That’ll very quickly install, and then you can go ahead and click “Activate.” Once that has activated, you can go over to your settings down on the left-hand side, and just mouse over to Google Tag Manager,and you can come in here and paste your Google Tag Manager ID into the field here. Again, in Google Tag Manager, you’ll see it here, and you’ll want to go ahead and click “copy,” paste that in, and then hit “save.” Just a quick review. We’ve logged into WordPress, right? We’ve added the new plugin, right? DuracellTomi’s Google Tag Manager for WordPressplugin.
We activated it. We went over to “settings,” and then GoogleTag Manager, and we passed our Google Tag Manager ID into that field, and then we hit”save.” The default in this plugin is custom, and that’s what we needed. That’s fine. You can leave it as custom. What this means is, we actually need to tweak your WordPress template just a little bit in order to get this to go, right? If we go ahead and copy this snippet, this is what they’re asking us to do. If you select “custom,” you need to edit your template and add the following line just after the opening body tag. The plugin is passing over to the template the actual Google Tag Manager ID. We just need to do one other quick thing in the body of the document to get this to go. This is only a one-time thing. The beauty of it is once we do this work, then we can kind of add pixels and remove pixels ad nauseam, forever and ever, without having to do this again. This is what’s really nice about it. Go ahead and copy this once you’ve hit “save.”
We’ve copied this little snippet here. I’m gonna go back to the SOP and check this out. We’ve copied it here. Okay, that’s great. In the WordPress sidebar, go to “Appearance,”then “Editor.” Make sure you’re editing the theme that you currently have installed in your site, and add it there. What’s going on here is, everyone’s theme is gonna look a little bit different. I’ll still show you the way to do it that should apply to most WordPress websites, but in general, every theme sort of has different files, and might look a little bit different, so don’t worry about this too much. We’re gonna go over to “Appearance,” and then”Editor.” “Appearance,” on the left-hand side, and then”Editor.” Okay. We’re now in the theme editor within WordPress,checking in with the SOP again, so select the theme header template from the list on the right, and then basically paste the code in after the body tag. We’re gonna look for the theme header file on the right. I can see it right here. If I wasn’t able to find it that quickly,I like to just do Command-F and look for it, so there it is. We’re gonna click that. That’s showing us the actual theme header file here in WordPress. We’re gonna find the body tag.
It’s usually near the top. It was there at line 25. That was very easy. Again, if I couldn’t find it, I can just Command-Fon a Mac and type “body,” and that shows it right there. All we have to do is find that opening body tag, which we did. We’re gonna add a space, so just hit enter,and we’re gonna paste in that little snippet that the plugin gave us, right? That little PHP snippet the plugin gave us,and we’re just gonna come down and update the file. “File successfully edited.” Sweet. We’ve set up a Google Tag Manager account. We’ve installed a WordPress plugin that allows us to easily add the Google Tag Manager code to the site. We’ve just added it to the site. Now we just need to do some quick QA, and make sure that it’s all working, right? We’re done up to the installation part. Now we just want to verify that everything is working. First, I’m gonna open up the site, and then we’re going to use the Chrome plugin that we installed a little bit earlier, the GoogleTag Assistant, which will tell us whether or not we did it correctly. Let’s open up the site. Here’s our beautiful website, ASiteAboutEmojis.com,and remember, we installed the Google Tag Assistant Chrome Plugin, so all we need to do is click here, right?
I’m gonna just leave all the defaults there. That’s no problem at all. Click “done.” All we need to do is click “enable,” and then reload the page. I’ve reloaded the page. I’ll open this up, and there it is. Google Tag Manager is working. We’ve got a little smiley guy here, and we are now installed. That is it. That’s how to add Google Tag Manager to yourWordPress website. I hope that was useful. If it was helpful, and if you learned something today, go ahead and click “subscribe” down below for even more digital marketing tactics and tips from us. If you’re watching on YouTube, I’d love a comment. What did you think? Is this how you’re gonna do it? Do you like to install Google Tag Manager different way? I would love to hear what you think. I read every single one. Finally, if you want this entire walkthrough as a free downloadable guide, along with links to all the resources we mentioned today, go ahead and click that link down below to ClickMinded.com right now, to get your free downloadable guide. Thanks a lot.