How to Use Google Tag Manager to Set Up Event Goals in Google Analytics

Today I’m going to be walking us through how to leverage Google Tag Manager in maybe a way that some of you aren’t doing at the moment. This is a skill that I learned a couple of years ago, and it’s helped me better understand how my users are using my site, but also how to track goals. More specifically, let’s say, I want to know how many people are clicking on this button, and maybe that has to do with revenue or the number of people enrolling in the course. Now, the reality is I don’t market this site very much like I should, so there’s not a whole lot of people signing up. But I do have a couple of courses here, and let’s say I want to know how people click on them and then how many people follow through to a purchase page or something like that, I can set up goals.

Now in Google Analytics you can do this using URL tracking. So you can say the Thank You page can be the conversion point, and I can track goals in Google Analytics like that. But what if I wanted to track a goal using an event, like somebody clicking on this specific box here? Well, you can go in and you can add these different triggers to this specific page, but with a site like this, this is a Teachable site, I don’t have access to this code, so I’m going to have to use something like Tag Manager to solve that problem.

So we can go and head over to Google Tag Manager, and if you don’t already have a container for your site, you would create a new account. It’s pretty simple. You’re going to call it something. For this case, we’ll call it Hack My Growth. You’re in the United States. You can share stuff with Google if you want to, and you have to use your URL here. As you see, they want your URL, they don’t want all this other fancy stuff, they know it’s a website. Choose what it is, website. Obviously there are other options today. You don’t have to sign your life away, understand that Google’s going to track all your information. And now you’ve got your install code.

Now, these need to be put into your site. If you have a WordPress site or a normal site then you would want to put this right there in the header and then this right after the body tag. If you’re using HubSpot, you want to put this in the head, this needs to go in the footer. We’re using Teachable for this specific thing, so I’m going to have to put this in the header and then put some Facebook pixels and stuff, Hotjar tracking. We will put this in the bottom, we’re kind of stuck with where we can put certain things, so go ahead and just put this stuff right here, test it out. This is what we have to do sometimes, right? In the world of web when we don’t know exactly where certain things are going to go or end up. And then hit save once you’re done.

Now, there is a Chrome extension right here that lets you know if you have your tags installed right. It’s Tag Assistant, by Google. I highly recommend it. You want to go here and hit, enable, and then we’re going to have to refresh this page. Now what you’re going to see here is we’ve got too many Google analytics and a Tag Manager code. So that’s interesting that we see all these analytics. I’m not sure where they’re all pulling in from because there’s only one Google Analytics code. But again, that could be an error with Teachable too, but I’ll investigate that here in a second. But we can see, Hey, we do have the Tag Manager script in, although it did fail to fire. So this means we don’t have anything in the container. This could be due to an empty or unpublished container, which is exactly what we have over here.

Now, there’s a lot of different things that you can do in Tag Manager, and you can track almost any movement on your website using different Tag Manager scripts. Now there are some very cool recipes that are built by other companies. I like to use a site called Bounteous, they’ve got some pretty cool recipes for your Tag Manager where you can upload a JSON file and it’ll do a lot of very cool things for you. And I can show us how to do that really quick. So Bounteous is the name of the site. It used to be LunaMetrics, but they merged with another company. So Tag Manager scripts. It’s just to do a recipe, to make it easier on us.

So they’ve got a number of different packs here. As you can see, this is the complete pack for Google Tag Manager, and if you want to see what tags are involved, we’ve got things like contact links, file downloads, outbound link clicks, page views. They build all of these other trackers in here for you so you don’t have to do it, which is really cool. So you download the file, and you want to save it as a JSON file. Desktop. And there you go, that’s pretty much all you have to do.

Now what you do is you go in here and you go to the admin section of Tag Manager and you go, import container. Now we’re going to choose that container file, which is the JSON-LD file that we downloaded on our site, and then we’re going to use the existing workspace because we already have a default workspace in here. And then we can overwrite it because we don’t have anything here at the moment. So we go ahead and confirm.

So what it’s done, it’s added quite a bit of thing here to our Tag Manager. It’s enabled a number of different variables, so different types of clicking and tracking. It’s also put in a bunch of tags for us, like listening tags, it’s done specific cookie removers, just so you’re getting the right event cookies. It’s done things like YouTube tracking, so any of the videos, if we had any YouTube videos, it would start tracking those. Contact us, link clicks, file downloads, all of that.

Now, if I hit, upload, and then I said to submit to this, it wouldn’t fire anything correctly. The reason is inside of these events, we have this right here, tracking information, and we haven’t made sure that this is going to push information back to our Google Analytics account. Just because this says your tracking ID, doesn’t mean there’s any information in there. So if we went over here to the variable and then we pulled down where it says your GA tracking ID, you can see there’s nothing here. In order for us to make sure that all this information actually ends up in our Analytics account, we have to have our tracking information.

This is where you go to Google Analytics, and you should have an account for your site, you would go over to admin, tracking information, tracking code, wait for it to load, and here’s your tracking ID. You want to copy this and then you want to come back to Tag Manager and add your tracking code here and hit save.

Now once again, just because we have this in here, we haven’t hit update, we haven’t pushed live anything yet. As you remember, we saw some of the Google Analytics tracking stuff kind of fire funny on our homepage, right? When we went up here and we said, Oh, there’s all these Google Analytics accounts attached to this. This is a problem. And when it comes to Analytics, when you have these different tags firing you can run into a number of issues. The main thing is Google trying to send information to multiple Analytics clouds, you could get incorrect data as far as visits and users. It can screw up your information. So that’s a problem that you want to make sure that you solve if you see this. You should only have one Analytics account associated with your site.

Now I’ve got to figure out how Teachable does that and I need figure out where that other one is accidentally, and, honestly, it could even be in here if I looked down through some of this information here. Facebook pixel codes. Yeah, it doesn’t look like it’s in this part. So there’s probably another part of their website that has a Google Analytics tracking snippet that I need to go figure out. I know they’ve got integration with it, and that’s what I was using, but there’s something else going on there. But this is not going to hurt us as far as what we’re doing here and building out these different goals.

Now you might look here and see that there’s also something called events, and these are what we’re going to use to build out our goals. Now different events here are going to do different things for us. This one is going to trigger anytime somebody clicks an email address or a phone number, it’s going to register an event inside of Analytics. Anytime someone downloads a file, it’s going to tell us what file they downloaded. If anybody clicks an outbound link, it’ll tell us what link they clicked to leave our site. This is really helpful if you understand what types of content your users are interested in besides your own, but it also will let you know where they went after they left your site, which is something you don’t typically know.

Scroll tracking. This will track how deep someone’s scrolling, so it’ll tell us 10, 20, 30, 40% of the webpage. YouTube track I talked about, and then page views, since we already have Analytics installed we don’t need this one. We can go ahead and delete it or we can do another feature called a pause. When I pause this, it means it’s not going to fire the tag on my site, so I’m not going to add in another instance of a Google Analytics tag, which is something I definitely don’t want to do.

Now these are really nice and they’re very helpful, but let’s say we wanted something more specific. Let’s say I wanted to click track and set up a goal in Analytics on anybody who clicks this, enroll now, button. Where I would do that in Tag Manager, so I’d come over here and I would add a new tag. And I like to organize my tags, so I typically do them in a very similar format to what Bounteous does. And I’ll just title it, enroll now, click. And we want to pick a tag configuration. We want to use the universal, Analytics universal tag, and we want to change this from page view to event.

Now you’ve got different parameters here, and these are the things that you can fill out, you get to fill out. So again, I would highly recommend that you do some sort of hierarchy, so categories could be buttons, the action would be, enroll now, and then the label, I like to do something like page URL. This will tell us what page they clicked on the button, enroll now, in.

Now if we go down here, you can have all of these advanced settings, you can go ahead and leave those alone for now, but you want to select a GA variable, and make sure that it’s connected to your Google Analytics account. So we can go over here and we can even create a new variable, which we did with the previous one. It’s not tied to what we’re doing in the script, that’s why it’s not showing up here. GA account. Now how more than one here, again, it’s not going to break your site. This is the link between the Tag Manager and your Google Analytics account.

So once I hit save, I have that variable here, and now we need to tell it when to fire this tag. When do I fire this event so that it’s happening? We’re going to add a trigger. Now we have these ones that are already set, but none of these apply to what we’re doing with this button right here, the, enroll now, button. So I want to create a new trigger and I want to call this, click enroll now. And we are going to do all elements, and then we’re going to do some clicks, and now you’ve got all these different variables that you can choose from.

Now if I look through this list, I will see that what I want to see isn’t available. I’m looking for something that’s going to help me fix or find a button like this. Now we’ve got a couple of different ways to track a click, so we can do it from a click element, we can do it from the file extension, name, host protocol, URL, container, any of these domain-level variables. We can do it by the Google Analytics account, we can do it by JavaScript. There’s a lot of things here. It can get kind of confusing, right?

I like to do, and now if you’ve only got buttons like this that are very specific, we can also look at some of these other built-in variables. So we’ve got something like click text, which can be very helpful in this case if we want to click that. Now if you do a click text, you’ve got to make sure that only the buttons you want to track have this text in them. What we would do is we would then inspect this site and find the text right here. It’s, enrolls now. So I would do click text equals enroll now. So anytime somebody clicks a button with the text that says, enroll now, it’s going to fire this tag. You can also do it a level up, if you want to, like class, primary, button, text, homepage, hero, enroll now. I could use this class to also fire the tag.

Now again, if you’ve got the ability to edit your class and you can add in your custom class for tracking, I highly recommend doing that to the domain level. The reason I’m showing you on a site like Teachable is that we are handcuffed, and this is where Tag Manager comes in to be a very helpful tool. Because if you have a site where you don’t have as much access to the code and you can’t manipulate things and add stuff like data to the code level and you can’t add just a script just for tracking, Tag Manager allows you to do a lot of these things that you wouldn’t otherwise be able to do. So now that I have this button and I’ve added the code in here, I want to hit save.

Now we made a ton of changes into this Tag Manager instance, and what I want to do now is submit these changes. So I like to always describe the version because you can do version control in Tag Manager, but we can just do this bulk setup because I know that we did a lot of changes here. Ideally, you would change and save after every change, that way you know really what’s going on.

So once we’ve got this, we want to make sure that it’s working, and in order to do that, we’ll go back to our workspace, we’ll hit this button that says, preview. This enables a preview view for us in our site instance, so if I go back here and I refresh this page, I should see a preview box. What this does, it tells me what’s firing on the page. So listener codes fired, tracking code has started, YouTube, it’s looking for all of that. Notice it has not fired our button yet. Now let’s see what happens. Enroll now click, fire. Now obviously we changed the page, but if I go back over here and I go to real-time overview, I should be able to see an event, because that’s what we sent, was triggered in real-time. So the button was triggered, enroll now was triggered. So we know that this is working, which is awesome. It means we’ve been able to see somebody click the button and enroll now.

Now let’s say we want to make this a goal like we wanted to know how many people who visit our site, click the button. We could keep it as an event, and those would be here under behavior, and we’d be able to track those events, but let’s say this is a goal, our client wants to know how many people are clicking on their enroll button, or maybe we want to know for our own business. We would go over to admin. I’m going to open this in a new tab. We would head over to our view settings because we’re in the view that we want to see right now, and we select goals.

Now in Google Analytics, you get 20 goals. As you can see here, we do have some goals already set up, but let’s say I wanted to set up this event goal. These are all destination goals. Here we go. We will go here and do custom, then we will do enroll now, and we’re going to choose an event. Continue. Now, this is very important, sometimes people will go in here and they’ll just fill this out and wonder why things don’t trigger. You have to match it exactly. So the event category is a button. The event action is, enroll now.

Now if you want to use the label, you would have to do it for the specific pages, or we could leave it blank and we could pull that event label information from the events instead of the goal. But here we’re really looking at a button and enroll now. Use those squiggly marks, the brackets, the braces that are shown in Tag Manager, it’s not going to make this work. So we can always verify our goal, obviously, it’s a brand new one, but after you do that, you add in your category, your label, and action and label, label if you have one, you hit save. You add value too if there’s a monetary value of this. Now we actually have this enroll now button set up, and anytime somebody clicks it will actually trigger an event in our behavior section, but it’ll also now show us as a conversion.

Now, the one I just did is, the real-time one, is not going to show up in here now because it takes a little bit of time to process that information into the rest of your account, but at least I do have it showing up in real-time.

Leave a Reply

Your email address will not be published. Required fields are marked *