Welcome back in the sixth lesson of our GTM for beginners series.
I'm going to show you how you can trigger your Tags upon interaction like a
button click on your website with Google Tag Manager. All and more, coming up.
Hey there Measure Geeks.
Julian here, back with this sixth lesson of our GTM for beginner series.
Now we have already fired our Tags via Google Tag Manager,
but only when somebody entered a page or went to a specific page on our
website.
But the cool thing about Google Tag Manager is that you can actually also
trigger your Tags upon interaction. So for example,
a button click a scroll on your page, or when somebody watches a video.
So in this video, we're going to explore what auto event tracking is all about.
And we are going to fire an event to our Google Analytics 4 instance.
But before we get started,
I have a little challenge for you head over to measureschool.com/lesson6,
where I have a quiz prepared for you. So pay attention and let's get started.
So back in our demo shop,
we already have our tax firing or Google Analytics per PageView and our Facebook
Pixel. And when we go to our confirmation page of our lead form,
we also fire our Tag for Facebook.
But what about this interaction tracking? For example, when we would track,
if we go here to a product page and we would like to
check if somebody clicks on this, add to cart button,
how would we be able to track this with the help of Google Tag Manager?
But before we get started,
I have already a new entry in my attack plan here where I want to fire
an event Tag to Google Analytics 4,
and this is what we are going to try to achieve right now.
Now auto event triggers and these special kind of triggers within Google Tag
Manager that we can see right here that are able to pick up interactions
such as clicks, user engagement, like element visibility, form,
submit, scroll triggers, YouTube videos,
but also JavaScript and history change events. Now,
it's always important to understand that there are multiple ways of tracking
interactions on our page. So for example, with our form submit,
we could use the form submit listener, but we already said that the PageView,
the thank you page after the form is already sufficient to track our lead
inside of the Facebook Pixel. So there are always multiple ways,
but today I'm going to show you how to utilize one of these event triggers.
And for our purpose,
we obviously want to go with one of the click triggers here. We have two,
one is for a specific link click.
So a link would be something that leads to another page, but in our case,
we would just go with the all elements, click trigger.
I find this more versatile.
And it's usually what I choose when I work with click
triggers. So let's go ahead and click on all elements.
And what we're going to do right now is to generate a generic click. True.
So this will not have any tags attached.
We just want to see how this click trigger this auto event click trigger will
react in the real world because auto event triggers actually have two
functionalities. One is the click trigger itself,
but then there's also a listener functionality that actually listens to
interactions. So I'm just going to give this a name here, just call this click.
And this will find all clicks that are on the page.
You're not going to attach this to attack, but before we go on to preview here,
I would like to enable some variables that I have stored here under the built
in variables.
And these are our click variables that will be filled by our click
trigger. So here we have all our variables.
We can just enable them and see how they get filled by our click
trigger. So once they are all enabled,
we go on the preview button and then reload our preview and
debug mode.
And this time I'm going to go straight to the Hoodie with Zipper page with super
page. And right here, we should be in the Tag Assistant.
We see our page has loaded, but what happens,
what should happen is when I click for example, on the title of this page.
So I'm going to click here.
I should see inside of my Tag Assistant here that we have a
new click that was registered and our variables get filled as
well. So click classes, click element, click ID, click, text, and so on.
So I just clicked on our title and therefore the title is Hoody and Zipper.
So for example,
if I click into this field or let's click into this field right
here, we should have more clicks that came in.
And we see here that we click once one time on the search field,
which gets filled out by the click classes or our quantity
field, which got picked up. And now the ultimate test.
What we actually want to track is the add to cart button.
So I'm going to click on this and our site actually reload.
So it goes to the next page,
but that shouldn't be a problem with our new Tag Assistant here,
because we can see the 17th click was our click on the add to cart button.
And here we have it actually in the click classes, single add to cart button.
That should be our add to cart click, as we can also see it in the click text.
Now the next step is,
is to refine our trigger or to choose one of these variables that is actually
unique to our add to cart button.
And we can do this by going through the previous clicks that we have generated
and seeing what is unique about this add to cart button click.
So I'm going to go to 15 here. This is obviously a bit longer and it says cart.
We have here a click to our quantity field,
and this has a different click ID. And here we don't have much information,
but the click classes gets filled out about a search field.
And if I go back here to the 17 and it's pretty clear that one item that is
quite unique is that the click classes has single add to cart
filled out in the click classes.
So that should not be the case for any of the others.
Let me just click here through here again and see. Yup.
That is pretty unique for our 17th click single add to cart
button is within the click classes.
So what I'm going to do right now is copy this and then head back to my Google
Tag Manager and turn my generic click trigger,
which just has the listener functionality into a specific one,
which would own the turn true when the user clicks on an add to cart button.
So I'm going to make this an add to cart,
click trigger, Oh,
we have to click already on there and let's go ahead and now refine our
trigger from all clicks to just some clicks.
And we have all our variables here available. I'll click classes variables,
and we're going to go with the click classes, which should contain,
and we have many different other matching options here,
but we already made up our mind. It should contain single add to cart button.
By the way, you could also choose a completely different approach and say, well,
let's go with the click text because the click text is also very unique here and
it doesn't get overwritten or accidentally picked up by any of the other
events. So add to cart could also be a solution, but for now,
I'm just going to go with the click classes and save this.
Now the next step is to attach our new click trigger to a Tag.
And this time we want to fire a Google Analytics event Tagto our Google
Analytics 4 instance.
So we're going to go for new here and then click on Tag configurations and then
search for our Google Analytics GA 4 event,
as the configuration Tag,
you can simply choose the Tag that you have set up at the beginning of our
course, which is the GA4 PageView Tag. And then we come to some configurations.
So Google Analytics 4 has a new data model,
which entirely is based on events.
So all we can send in are really events and we can give our event a name.
So for example, any kind of click, and then we can send over more data,
more attributes of that click via this event, parameters, menu,
and we can enter anything we want here. So for example,
if you had a parameter called click text,
then we might want to fill this out dynamically with our variables that we have
available. For example, the click text right here,
and we could attach any more parameters that we might want, for example,
which product was added to the cart or what page URL was
the user on right now when he clicked the button.
But I'm just going to go with the click texts for demonstrations, take here.
And then we attach our trigger, which we have already prepared right here.
So let's give this all a name. This is a GA 4 event Tag for add to cart.
Let's
save this and now go into the preview mode. Okay.
Back on now page, I'm going to click the add to cart button. And hopefully now,
instead of the Tag Assistant,
we should find a click right here and we see our Google Analytics 4 event,
add to cart, click fired. Now,
if we are inside of Google Analytics 4 you should be able to go to your
debug view right here.
And then you see all the different events that were automatically checked,
but one of them is actually our click right here.
We can see all the different parameters that were sent over automatically,
but also our click text, which is our property that we've entered.
And it's filled out correctly with add to cart.
So the data has been sent by Google Tag Manager,
and it now arrived inside of Google Analytics 4 that seems to work fine,
but let's make sure that this actually only happens when I click on the add to
cart. And I'm going to click here and on the prize and here and here,
which should have a lot of clicks inside of Google Tag Manager.
And when we click on them, we see that no Tags fired.
And that is great because we have configured our trigger correctly
to only fire on button clicks on add to cart button clicks.
Let's see if this is actually dynamic.
So if I go to a completely different other page here and click
on, add to cart,
you also get a click and add to cart fired as well.
So it can be pretty sure that our add to card click has been registered
correctly with our Google Tag Manager auto event,
trigger for clicks. But the cool thing about Google Tag Manager,
as well as you can reuse trigger. So we have this trigger now set up.
We could configure attack to send data to another tool. So for example,
we have your Facebook,
nothing is stopping us from going in and creating a Facebook Tag,
just like last time with our Facebook ID. Now the ID,
I don't have saved, but I have my Tag plan right here. So let's copy that,
put it in here. And then we have our event name,
which we can choose dynamically unless we send over custom event,
but we have a standard event called add to cart.
So let's choose that and attach our trigger here.
So Facebook event add to cart
and let's try this out as well.
Let me actually go into the events manager here and test our pixel
on our demo shop. So we load this as well,
and we're going to click on the add to cart button and we see our Facebook
event now fight as well. And then the events manager,
we see our add to cart click that has now been picked up by Facebook
ads as well,
and can build in a custom audience or create a custom conversion if we
choose. So, so this has been created inside of Tag Manager.
All you need to do in order to take this actually live is to go over to your
Tag Manager and submit this as a version to all your users.
And this is how you can create auto event tracking with the help of Google Tag
Manager to fire your Tags upon interactions. So that's pretty neat, right?
Uh, I leave it up to you to try out the other auto event triggers.
We also have many videos on this channel on, for example,
the element visibility trigger, which can detect popups.
You can utilize the YouTube trigger to detect YouTube plays on your
website or the form submit trigger,
which would pick up interactions on forms. Now, was this all clear? Well,
then you should be able to test your knowledge at measureschool.com/lesson6,
where we have a little bit of a quiz prepared for you.
After you finished your quiz. We only have one last lesson left.
We're going to introduce you to some resources,
to find out more about Google Tag Manager and deepen your knowledge in this
tool,
but also continue your journey obviously on the Google Tag Manager path.
So if you're ready, check out this video right over there.
And if you haven't yet,
then you should definitely subscribe to our channel right over there because we
bring you new videos just like this one every week.
Now my name is Julian till next time.