Hey there, I'm Benjamin from Loves Data. Welcome to the third lesson in my Google
Tag Manager training series! In the previous lesson, we covered how to add additional
tags to our container, including the Google Ads remarketing tag and the Facebook pixel.
And in the first lesson, we covered how to get started. In this video,
you will learn how to test and preview tags that you've added to Google Tag Manager.
Whenever you add tags, triggers, or variables to your container, it's always a good idea to test
them to make sure they work as you expect and that they send the correct information to the platforms
you're using. For example, if we've added a Google Analytics tag to our website, then we should check
that the tag is firing correctly before we publish it to our live website. Okay, let's head to Google
Tag Manager... We can see that we have all of the tags we configured in the previous two lessons in
our container. So we have our Google Analytics 4 (GA4) tag... We have our Universal Analytics (UA)
tag and variable... And so on... And if we look at the card on the top right, we can see is says
that our container hasn't been published yet. This means that we've created the tags, but they're not
currently published on our live website. Since I'm using a new container that has never been
published the debugger won't connect, but let's take a look anyway. So let's click 'Preview'...
A new tab opens for Tag Assistant and we need to enter a URL on our website. You will need
to ensure that you've added the Google Tag Manager container code to all of the pages
on your site. If you haven't added the container code to your site yet, then feel free to pause
this video and watch the first lesson, where we cover how to install Google Tag Manager.
Okay, so I've already installed the container on my demo website, so I'm going to enter the URL...
I'm going to leave the 'include debug signal' option enabled, and I'm going to click 'Start'...
Another tab opens with the URL we entered...
And we can see at the top, that Tag Assistant is trying to connect to our website.
After a little while we can see it says 'Not Connected', so there's a problem. As I mentioned,
this is because the container has never been published. Okay, but what if you have already
published your container? Well, if the debugger still isn't connecting, then the first thing is
to check that pop-ups aren't being blocked by your browser. For example, if you're using Safari, then
Tag Assistant will try to open your website in a new window and this can be blocked by default.
You should also check that the correct Google Tag Manager container is installed on your website and
that you're previewing the correct container. You can also try closing the window or tab that
is used to preview your website, then refresh the Tag Assistant tab, and then click 'Start'
to reconnect to your website. In our case, we know that the preview mode isn't loading because
we've never published the container, so let's head back to Google Tag Manager to fix this...
Now we could select 'Submit' and publish our container. However, if we're migrating
to Google Tag Manager and we have an existing Google Analytics tag installed on our website,
then this will cause problems. So what we're going to do is temporarily pause all of our
tags until we're ready to complete our migration to Google Tag Manager. Let's select 'Tags'...
And now let's use the checkbox at the top to select all of the tags we've created... Now let's
click the 'Pause' button so that the tags don't send duplicate data once we publish the container.
Since we've now paused all of our tags, we can publish the container. So let's click 'Submit'...
And let's name the container...
Okay, now we've published the container, so the preview mode will work, however all of our tags
are paused, so we won't be able to test them using Tag Assistant. So now let's head back to 'Tags'...
And let's enable all of our tags...
Now let's select 'Preview'...
We can again enter the URL for our website... And click 'Start'...
Our website opens in a new tab...
And this time we can see that the debugger has connected. So we can navigate to another page...
And now let's open Tag Assistant...
On the left-hand side, you will see the pages that you've loaded while using the preview mode.
We can see both of the pages we viewed... We can also see the triggers associated with the pages.
This includes built-in triggers, like when the Google Tag Manager container loads on the page,
as well as any other triggers you've configured.
For example, if we select 'Container Loaded', then we can see the tags that fired for the page...
And tags that weren't fired... We can select a tag to then see more details.
Let's select the Google Analytics tag... We can see the details for the tag...
And below this, we can see the trigger conditions that allowed the tag to fire... And below this, we
can see any exception triggers that might prevent the tag from firing... Let's close the tag...
Apart from viewing the tags, we can also select the 'Variables' tab
to see the information that's available to use in Google Tag Manager...
And the 'Data Layer' tab lets you view the information in the data layer... Since we've
added a GA4 tag to our website, Tag Assistant will automatically identify this and you can
select the 'Measurement ID' for your GA4 property using the drop-down at the top of the tab...
This lets you view the information that has been sent to your GA4 property... For example,
we can select the first page we viewed... And this lets us see the different hits that were
sent to our GA4 property... And we can then switch back to our Google Tag Manager Container ID...
Apart from the GA4 tag, we can also see all of our other tags have fired.
All of these tags use the 'All Pages' trigger. Which means they should all fire on every
page of our website. Since these tags are all firing, we can see they're working correctly.
In a future lesson, we will cover how we can track conversion using Google Tag Manager.
This is where we will create a custom trigger that only fires on certain pages.
When we create a custom trigger it becomes even more important to preview and test your tags. And
here's my recommended workflow for Google Tag Manager... I recommend following these steps
for any changes that you want to make to your container. Whether it's adding a new tag or
even changing an existing tag. The first thing is to add (or change) the tags to the container.
This might also include updating or adding triggers and variables. Then it's time to
preview the tag, triggers, and variables you've added. Make sure you navigate to any relevant
pages (and perform any actions) you're aiming to track on your website using the preview mode.
As we've seen, this allows you to check exactly what happens, you can see the information that
is going to be sent and check that everything is working as expected. If you encounter any issues,
you can diagnose those issues while you're using the preview mode. You can also share the preview
if needed. You can then check the draft to make sure that any changes that have been applied in
the draft are correct before publishing. You can also check the change history,
in case anyone else might have been in Google Tag Manager since you started making these changes,
to make sure that none of their changes are also going to be published when you publish.
We will cover publishing your container, and considerations when migrating and deploying
Google Tag Manager in the next lesson. So that's how you can test and preview the tags
you've added to Google Tag Manager before they're published to your website. If you encounter any
issues when trying to preview your tags, then I also recommend trying a different browser.
And remember, if your container has never been published, you won't be able to connect to the
preview mode. Have you tested your tags in Google Tag Manager? Did you fix any issues?
I'd love to know! Let me know in the comments below. And if you'd like to continue learning
about Google Tag Manager, then if you haven't already, subscribe to my channel. Next week, I
will walk you through my migration and deployment checklist. This is especially important if you're
currently using the Google Analytics tracking code on your website. I'll see you in the next video!