GTM Tags, Triggers, and Variables Overview
Learn how tags, triggers, and variables all work together. The foundation starts with variables – they aren’t as scary as they seem!
Let’s talk about tags, triggers and variables. Tags, triggers and variables, oh my. Before we can talk about tags and before we can talk about triggers, we need to talk about variables first and get that scary word, get it out there. It’s not as scary as we think it is. Variables are really the foundation to triggers which are ultimately the foundation to tags. So we can’t have a tag inside of GTM without a trigger and a trigger can’t really exist without a variable. Variables come in many different shapes and forms and I’m going to try to keep it simple here and focus on a few related to eCommerce and just our general page type variables.
So we’re looking at a product page here and what stands out? What is unique about this product page versus other product pages? The name, the price, the variant, the URL, the product image. We can go on and on and on. This product page has a lot of key characteristics that are different than every other product page that lives on this sample site. It’s an amazing sample site as you can see. So those product names, the product price, the SKU, those are what we consider variables. As you can see here, we have Google Tag Manager open, which is this is the preview mode and we can see this product page. We have a product name, we have the product ID, we have the SKU, we have another type of product ID, we have our quantity, we have our price. These are variables that we’ve defined in the data layer, and we’ve surfaced that unique data of this product into variables that can be used in Google Tag Manager.
Let’s even take a step back a minute and even the most basic variable, page URL, page path, page host name. So those are variables. Variables are what we use to, again, to create triggers that apply into our tags. And then we apply these variables into our tags. There’re many different definitions about variables out there, but the easiest way I can explain variables is if it’s something that’s on your site or if it’s something that is even, like doesn’t necessarily live up in the open where it’s in the user experience. Think about product ID, your Shopify product ID. That’s not visible on the front end, but it’s something unique to a product therefore it either is a variable or could be a variable. It’s really a dynamic piece of data that lives in your store that can be used in other places. Now the thing about a trigger, a trigger is basically the rule that says, “Hey, fire this tag when these conditions are met.” For example, think about enhanced eCommerce. We have an enhanced eCommerce report that looks at product views and add to carts and all of that.
Me clicking this add to cart, that’s a trigger. I want to send an add to cart event to Google Analytics when anyone clicks add to cart on my product page. The action of somebody clicking add to cart is a trigger. I’m going to talk a lot more about triggers. You’re going to hear the word trigger probably a thousand times in all the videos, but a trigger comes in many shapes and form as well. We have click triggers, visibility triggers, scrolling triggers. If someone scrolls 50% down the page, I want to send that hit or that event to Google Analytics. The triggers are really the foundation of the event, AKA tag, that we are ultimately trying to execute and send that data to the specific marketing channel.
That brings us the tags. What are tags? Tags come in many different shapes and forms and they are probably one of the most complicated things when you try to explain like “I implemented a tag” or “Do you have that tag set up?” Or “How many tags do you have going to Facebook?” And when we think about a tag, when I think about a tag, a tag is really the piece of data. So let’s just talk about Google Analytics and the add to cart. So you want to send the add to cart event to Google Analytics. We need an add to cart tag that’s attached to a trigger that contains variables like product SKU, product name that we’re sending to GA. Let’s look real quickly here at an add to cart.
We have a tag that we’re calling an enhanced eCommerce event add to cart. We’re using the tag type of Google Analytics. We’ve attached a trigger, which is an add to cart trigger and we have a very simple variable page path which we’re sending as an event action. This is really as simple as we can get. We have an add to cart tag where we want to analyze what percentage of people are adding this product to cart or what percentage of people on my entire site are adding to cart. And we just have a trigger and a few simple variables tied to it.
What else can tags be? Tags can be pretty much anything. Google Tag Manager has a prebuilt list of tags, so their own properties like Google Ads, Google Optimize Conversion Linker, and then they have a bunch of other prebuilt tags. These are common tags, so think about Crazy Egg, Hotjar, you name it, LinkedIn insights, Twitter, et cetera. These are all prebuilt tags that we’d simply just go in, add the trigger to that tag. Let’s take Pinterest as an example. We have our tag, we assign a tag ID and we attach a trigger to this.
So tags, triggers and variables, they’re all interconnected. You can’t have a tag without a trigger and really you can’t have a trigger without a variable either. If we look at triggers here, our page view, so a basic page view trigger. We have a rule where this trigger fires on all page views and basically our page view is a page URL or something similar to that. And as we’re just saying, “All right, no matter what that page URL variable is, fire this all the time.” Or if we only wanted to fire a tag on a specific page, then what we could do is just create a very simple rule using this variable where page URL contains products.
When I’m going through the next few trainings and saying the word tags and triggers and variables, try to just consider everything is really connected where you can’t do one without the other two. And the world of tags, we are going to put a lot of focus on third-party marketing tags. Think about Facebook or Facebook events or pixels or ad words, remarketing tags, or Google Analytics, custom event behavior tracking tags. We’re going to really focus on what we see 80 and 90% of eCommerce stores using and Shopify stores using. It’s really honing in on our marketing tags and our Google analytics tags.