Google Tag Manager tutorial for beginners 2025 || GTM Course
By Analytics Mania - Google Analytics & Tag Manager
Summary
## Key takeaways - **GTM Speeds Up Tracking**: In the old days, developers added tracking codes but took days or weeks due to other priorities and back-and-forth questions. Google Tag Manager lets you manage tracking codes yourself much faster after initial developer install. [00:35], [02:01] - **Containers Hold Tracking Codes**: One GTM account represents a business with multiple websites, and containers are buckets for tracking codes—one per website or shared if structures match. Access multiple via container selector in the interface. [03:46], [05:32] - **Tags-Triggers-Variables Framework**: Tags are code snippets like Google Ads conversions; triggers define when like 'thank you page'; variables specify details like 'page URL contains purchase successful' or order total value. [17:32], [19:58] - **Preview Before Publishing**: Test changes in preview mode showing events like initialization where tags fire; verify in GA4 debug view before submit to create live version. Rollback via versions if issues arise. [31:13], [37:03] - **Refine Triggers with Variables**: Enable built-in click variables to see click classes like 'menu link'; refine 'all link clicks' trigger to fire only when click classes equals menu link for precise tracking. [56:07], [58:59] - **Custom HTML as Temp Fix**: Use custom HTML tags for non-tracking code like promo banners when developers unavailable, but warn it may block for ad blocker users and ideally belongs in site source code. [39:26], [44:04]
Topics Covered
- GTM Eliminates Developer Delays
- Community Templates Beat Custom Code
- Preview Mode Prevents Live Breaks
- Tags Triggers Variables Framework
- Click Classes Precision Targets Events
Full Transcript
if you are a digital marketer or digital analyst and you want to implement tracking codes much faster then Google tech manager is exactly what you need but how to get started how to properly
create your first setup without wasting too much time in this video I will show you how to work with Google tech manager how to install Google analytics and more keep in mind that these tools are
constantly changing so if you see major differences between my video and what you see in the interface then take a look at the description below the video there might be a newer version of this tutorial
available so what is Google tech manager the best way to explain it is to show an example let's say that you're working for a company or maybe that's your client's company and if you have some
visibility online most likely you will have a website or maybe several of them to measure the effectiveness of these websites you would need some analytics tools for example Google analytics and
that's where you join the game you need to install Google analytics on those websites in the old days or we can call that in a classical way you would need a
developer to do the job in this case the developer is responsible for adding tracking codes to the site maybe sending some additional data events and so on
but the developer usually is not very much familiar with analytics tools that's why he or she asks a lot of questions for example when do you want those tracking codes to be activated
what kind of data do do you want to send if you want to send some event data when exactly do you want to send it to Google analytics so after a while you send messages and emails back and forth and
eventually developer confirms that he or she understands the task so the next step would be for a developer to implement those tracking codes but usually it takes a lot of time because
developers have other priorities and in most cases analytics is not their top priority so you might wait for days weeks until those tracking codes are
added and that's where Google tech mag becomes very useful because it allows you in many cases to speed up the process and manage those tracking codes
by yourself so here's how Google tech manager Works in a nutshell you have a website and your developer installs Google tech manager on a site and then you manage your tracking codes inside
Google tech manager so basically when GTM is activated on a site it activates your tracking codes as well of course based on the conditions that you define
in Google tech manager speaking of benefits Google tech manager has a lot of them first of all all your tracking codes are stored in a single place so it is easier to find them to manage them
and to decide when to fire them of course then you're less dependent on developers this does not mean that Google tech manager will replace the developers completely because in some
cases developers will still be needed but there will be many more situations where you will be able to add tracking codes by yourself and do that much
faster that's why the third benefit is the speed also Google tech manager is very popular it still continues to grow this means that there are various learning resources in different formats
like block post documentation videos there are also various forums communities so if you get stuck somewhere there is a very high chance that you will be able to get help fairly
fast to get started go to tag manager.
goole.com if you have never worked with Google tager before then you will see an empty list let's click create an account here there are two main components we have to configure the account and the
container account is basically an organization or business for example and that business might have multiple websites so inside the account we then have to configure containers one
business might have more multiple containers container is like a bucket where you can store your tracking codes you might create separate containers for each websites that belong to the
business or you might have even one container that will be used on multiple websites if that of course makes sense in your context so first let me enter
the account name for example analytics Mania GTM and then you can select your country then we will have to create a
container so let's say that I will call it demo container and in this case we will be focusing on web tracking that's
why the type of this container will be web then let's click create then we'll need to accept terms of services and click yes now your Google tech manager
container is created and this is the code that you will need to install on your website or maybe your developers will have to install it we will come back to this later right now now let's
close it when you want to access Google tech manager you must have a Google account this is your Gmail account that you also use to access things like Google analytics Google ads and other
Google products then when you have that you can create Google tech manager accounts as I've said one GTM account is for a business that's a company and then
within each account you can have one or more containers if the business has multiple websites for example they have a Blog they have a main website and their structures are very different and
the tracking cods that you're are going to use are pretty different then I would recommend creating separate containers for each website this is the interface of Google
tag manager if you have access to multiple Google tag manager containers or accounts you can select them right here so click on the container name and if you have access to multiple accounts
you will see the list right here and you can click click on a particular account and then here you will see a list of containers inside that account then here
we have like the main menu bar and here we have workspace that's the place where you will be spending most of your time then you have versions and admin speaking of workspace this is where you
manage your tags triggers and variables soon I will explain what these are and how are they connected and what are their roles but right now the main thing that you would need to know is that tags
are your tracking codes that you install in Google tag manager if you want to keep your items in the container tidy you can put them into folders for example you can create one folder for
Google analytics tracking codes then another folder for Google ads codes and so on then we have templates so even though Google teag manager has a lot of templates available by default there are
many more tracking tools and vendors that you could install in GTM so it's very cool that that there is a gallery of templates where the community and
other vendors can add templates and they will save you a lot of time so instead of adding just plain JavaScript code to Google tech manager you have a lot of options right here for example if you
want to add a Facebook pixel which is also known as metap pixel you can just add the keyword Facebook and you will see the templates right here and there are a bunch of them and once you add a
template then if you go to tags new then click tag configuration you will see those templates right here because this is right now the list of built-in
templates but if you add templates right here then you will also have some custom templates now you might be wondering what is a template so in a nutshell it
basically is a list of various fields and options that you can insert so this is a template instead of working with the plain code you have Fields like
inputs checkboxes maybe radio buttons drop downs where you can insert certain settings and then your tag management will be much easier because alternatively as I've said if you want
to add some tracking code and there is no template available you would need to use the custom HTML where you just basically paste the code and then that code will do something but that's enough
about tags for now we will come back to them soon so as I've said the workspace is the place where you will be spending most of your time and you will will be managing a lot of stuff like tags
triggers and variables if you add some changes to the container those changes will be listed right here in this section then we also have the container quality section so right now the
container is not installed yet therefore there is no data but this section is designed to give you some alerts or Warnings if certain settings are not configured yet or maybe something is
configured incorrectly of course sometimes false positives happen but there are definitely some warnings that are useful and will help you avoid
certain mistakes so that's about it regarding workspaces now the versions so when you publish the Google tech manager container and maybe you launch some new
changes each moment when you publish something that becomes a new version of the container the cool thing about versions is that when time goes by and
you have more versions here if needed you can roll back to the previous version for example let's say that today you published some new changes in your container and something broke there is
some mistake that prevents your tags from working so if that happens you could then go to the list of versions find the previous version then click
Three Dots and publish that way your previous version will go live to the website visitors and your tracking will start working again then we have the admin section here you can manage for
example users on the account level who will have access to what or you can manage users on the container level you can also find some settings here but
there are not many of them then you will find the Google tech manager container snippet or container code right here that's what you will need to install on
the website and then you can export the container for example let's say that you have two containers and on the second container you want to replicate all the tags triggers and variables that you
have in the first container so in in the first container you click export and then export that container and then on the second container you go to the admin click import and import that file and
that way you will be able to replicate the setup fairly quickly then there are several other options right here but this would go out of scope of this tutorial so the key essential things are
already mentioned in this video now a couple of final things for this part is that in the workspace when you do certain changes you can publish them which means that they will go live to
your website visitors but before you do that you always have to test this and this can be done with the preview mode soon I will show you how to use that but right now I'm just kind of describing
the process that you will need to follow you do some changes in the container you preview them and once you test this then you click submit and publish a new
container version which will go live to your website visitors also you can find the Google tech magic container code by clicking on the container ID this is your ID and if you click it then here
you will see two codes that you will need to add to the website the first one is the most important this one is optional and then you can test this but later I will show you how I test my
setups before you start adding tags triggers and variables first you have to install Google tech mager container on your website and then when the visitor lands on your website site Google tech
manager will be loaded and then imagine Google tech manager acting as a portal so through that portal various tracking codes will be activated to your website visitors based on the rules that you
configure right here in the interface to install Google tech manager click on the container ID right here and you will get two codes the first one is essential if you want your tracking codes to work
this one is optional as the instructions say you have to paste the first code somewhere in the head so you can copy it and then the actual installation process
depends on how your website is built and what kind of content management system or e-commerce platform are you using so first I will show you what to do if you are dealing with a custom website then
you will need to copy this code and if you have access to the website's code then you can add the Google tech manager container somewhere in the head so this is the beginning of the head and this is
the end of the head and then the coner code could be added like this so this is ideal of course technically you could place this even higher but I would not recommend adding this higher than the
title tag in the head but if you are limited by certain restrictions or maybe your developer does not agree to add this and the developer says that he or she will add this somewhere in the body
technically that is also okay your Google tech manager will still work but ideally in my opinion I usually add it or ask to add it right before the end of the head so this is where the first code
could be added and then the second code should be added immediately after the body tag so this is the opening body tag this might be used for things such as
verification of your Google search console ership or for some other things but the priority of this is much lower if you don't have the option to add this
this is okay this is the most important code that must be added to your website and then once these changes are done then you would need to click save and this would go live to your website visitors of course it's important to
note that Google tech manager container code must be added to all pages of your website then another situation might be that maybe you're working with some popular content management system or
popular e-commerce platform so maybe they already have some plugins or built-in functionality to activate Google tag manager for example if you're working with WordPress there is a very
popular plugin called Google tech magic for WordPress when that plugin is activated you would then need to go to settings Google tag manager and then here you would need to paste your
container ID you can find the container ID right here let me zoom in a bit and it's the same ID that you have right here so once you have that ID you paste
it right here then you can go with codeless injection of the no script part but as I've said it's not that important and then you click save changes and this will handle the installation for you of
of course this plug-in has a lot of other features that adds additional data which could be available for Google tech manager but the explanation of these parts would go out of scope of this
tutorial and the third situation that you might find yourself in is that you are working with some content management system but you don't have access to the code and you don't have access to some
plug-in because there is no plugin for that particular platform but maybe you have an option where maybe somewhere in the setting you have a field where you
can add custom code so on this particular website builder you have a field that says side header code and here you can paste the Google teag
manager container snippet since we're talking about header it means that this code will be added to the Head the second code should not be added to the head so if you don't have an option to
add custom code to the body of the site then just ignore this code you don't need it this is the most important and this should be added ideally to the head but you can technically also add it to
the body if head is not available and finally after you install Google tech manager container code or maybe a developer tells you that the code is added now you have to test if it is
added properly even though you have the test your website option right here personally I don't use it I instead go to preview right here then I have to enter the URL of the website where I
want to test the setup in my case I have this demo website right here and I will click connect so if Google tag manager is installed properly you will see that
tag assistant has connected here and then you will also see at least these five events right here you might see more which is okay but you have to see
at least these five items right here so this is called the pre mode and if it does not connect for you then it means that either installation is done incorrectly or maybe you have some ad
blockers or maybe there are some other reasons so if you need to troubleshoot why the previe mode is not working for you I will post a link to a troubleshooting guide below this video
and one final thing for this particular section is that I would recommend for you to install a Chrome extension called tag assistant companion it will enhance
the capabilities of the prevote and it will be a bit more convenient for you to work with it so I will post a link to it below the video install it and then we can proceed to the next topic
now let's talk about the key components of Google tech manager tags triggers and variables tags are pieces of code that you add to Google tag manager and then
based on your conditions those tags will fire tags can be tracking codes they might be codes that change the color of the button they might be some other
codes so basically a snippet of code that you add to your website then you need to decide when do you want the those tags to fire that's where triggers are needed so a trigger is a set of
conditions that must be met and then if that happens the tag that is linked to a trigger is activated and then the third component is variables and when I was
learning youch manager the relationship between tags and triggers was clear for me but I was not fully understanding what kind of role are variables playing here so let me explain that in a bit
different way when I teach the concept of text triggers and variables I usually like to do that with three questions the first question is what do you want to do for example if you want to track a
button click you need to activate some code so that code is a tag if you want to track a purchase that is a tag then the next question is when do you want to
do that so when do you want to activate the tag your example could be when a user makes a purchase or when a user submits a form or something like that so
the answer to When is the trigger and the third set of questions is what when or how exactly and that's where variables are needed because when you
say that you want to fire a tag on the order confirmation page you need to be more specific how can you specify the thank you page well with a page URL so
if page URL contains let's say thank you for purchasing the page URL in this case is a variable let me show you an example let's start with what a tag in this case
case a tag could be a Google ads conversion tag because what will this tag do it will track a conversion when will that tag do this it will do when a
visitor lands on a thank you page or also known as order confirmation page and then when exactly or what exactly or
how exactly so in this case the when exactly would be when page URL contains purchase successful so the page URL in
this case case is the variable but also with that conversion tag we could send the value of order total how much money did the visitor spend on our site with
that purchase so another variable could be order total because it contains a monetary value of the purchase let me visualize this with the previous explanation where we had tax triggers
and variables now let's replace these words with the actual example we have Google ads conversion tag it will fire on a thank you page but Google tech
manager is not human it's a system so you need to be more specific what does a thank you page mean it basically means that the page URL must contain purchase
successful so the page URL in this case is the variable that we use in the trigger and then together with the Google ads conversion tag we want to send the order total so that's another
variable if this still sounds confusing don't worry we will soon be using those variables in action and then you should start understanding this concept
better in this tutorial the tracking codes that we will be adding to Google tech manager will be of Google analytics 4 but before we do that here is a very brief introduction to Google analytics
Google analytics is a platform that lets you analyze how your users are behaving with your website and your mobile apps in this tutorial we will be focusing only on websites with Google analytics
you can see how many visitors did you get where are they coming from what kind of interactions are they doing on your website and of course you can enhance your setup by sending some custom events
for example form submissions and so on on the left sidebar of Google analytics you will see the main menu and you will be spending most of your time in the report section and explore in the report
section on this sidebar you will see a collection of reports this sidebar is highly customizable so in your property you might see a different collection of reports or if you want you might even
add more reports in this property if I want to see where are my visitors coming from I can go to acquisition and then traffic acquisition this table will show
me the top traffic sources and many users prefer selecting the session Source medium instead and here we can see that a lot of people are coming from
Google or G organic search also from Google paid ads also this particular website is running email marketing so some people are coming from the newsletters and so on each column in
this table except the First Column is showing metrics for example we can see how many sessions did we get from each traffic Source then you can also see how
many key events did we get from each traffic Source key event was previously known as conversion so certain events for for this company are more important
that's why they are called key events for example if I click right here I can see the purchase events and this is how many purchases did we get from each traffic Source if you have implemented
e-commerce tracking which might require some custom implementation then you will also see how much revenue did you get from each traffic Source if you want to see your top pages then you can go to
engagement and pages and screens or maybe it will be located somewhere else but just keep looking for a report that says something about pages in this
report we can see which are the top pages how many times was each page viewed that's where we are using the views metric we can see how many users
viewed these particular pages and so on if you want to check what are the landing pages also known as the first pages of the session then you can go to the landing page report and this is
where a lot of visitors are landing speaking of the reports and charts let's go to traffic acquisition so by default this chart shows the top five traffic
sources and then this dotted line right here shows the total traffic if you want to analyze just a particular traffic Source then you can for example select
just organic uncheck everything else if you want to keep total you can keep it as it is or you can uncheck it and then click plot rows now the chart will be
showing just those rows that are selected right here the explore section on the sidebar contains additional methods that you can use to understand
your data this is a bit more advanced compared to the reports section but nevertheless it's still pretty useful for example I usually use free form
funnel exploration and path exploration let's click on the free form and here we will get an example of different cities and here each column represents a
different device category so this is how many desktop users do we get from New York then from Los Angeles and so on due to certain limitations Google analytics
might not always get the location of the visitor and that's just how our industry right now works so in that case if a particular value is not known then you
will have the not set row in your table now let's take a quick look at another exploration method let's go back to explore and if I select funnel
exploration it will show me a funnel in this case this is a predefined funnel where we have the first open Event then session start then page view and then
purchase this does not look very useful but if you want you can modify it by clicking a pencil in the steps section then we can remove these and build a
different funnel where let's say the first event will be where the product is viewed and then an event for that that will be view item keep in mind that out
of the box goigle analytics cannot track view item or purchase events you will need to either implement this yourself with a developer or maybe by yourself if
you know how to do that or alternatively maybe it is possible that your website has a particular Google analytics integration that sends this data to G4
so the first step will be viewed item then another step will be let's say added to cart and then they event for that is called add to cart and then the
third step let's say is begin checkout an event for that in this property is begin checkout and then finally we will
add a purchase step where the event name is purchase now if I click apply I will see how many people viewed any product then how many people out of those added
any product to your cart then out of them this is how many started a checkout and then this is is how many people completed the purchase let's install Google analytics
with Google tech manager go to analytics.google.com if you have never
analytics.google.com if you have never worked with Google analytics before then you might see a view that looks like this here you will need to create an account property and then add some
additional details a Google analytics account just like it is with Google tech manager account should represent a business so if you have multiple websites then you should have one account and then inside that account you
will have properties one property can be used by one website or you can include multiple websites in the same property but if you already have created an account and you just want to create a
new property then go to admin and then click create property as you can see the step related to account creation is no longer here so let me create a new
property I will call this let's say analytics Mania demo then select the reporting time zone I will select
Lithuania then the currency I will select Euro and then click next then you should select your industry category right now I will select let's say
internet and then the business size click next then you have to choose your business objectives the check boxes right here will affect what kind of
reports will you see in your ga4 property usually I'm using the other option right here and then click create then you will be asked to create a data
stream in a nutshell data stream is the place where you collect your data and then Google analytics will take that data from data stream and will display it in the report since we are focusing
on the website tracking we will click web then I will enter the URL of the website my demo site looks like this then I can call this let's say website
and click create and continue then I will get the tracking code but we will not need the entire code because we are working with Google tech manager so
for now I can just close it then here we can see the webstream details including the measurement ID that we will use and then certain other settings if you already have a Google analytics for
property then you can find these particular settings by going to well actually let me quickly find that so I will go to home and then if you already
have a property then go to admin data streams select your website data stream and then here is the measurement ID so this is the most
important part for us right now let's install this property with Google tech manager let's go to GTM and then in the workspace go to tags then click new and
when you create a tag you have two sections tag configuration which means what will this tag do and then triggering which means when do you want want this tag to be activated let's
start with the tag configuration to install Google analytics you will need to select Google analytics here and then select Google tag here you have to paste
the tag ID in our context tag ID is the measurement ID so I will copy this and then I will go back to Google tag manager and paste it once this tag is
fired on our website it will activate Google tracking code which is related to this measurement ID now the question is when do we want this tag to fire when it comes to Google analytics you have to
activate the tracking code on every page of the website that's why we should go to triggering and then here we have three triggers by default even though
you might be tempted to use all pages ideally you should select initialization because it fires a bit sooner Google tag must be the first Google analytics tag that fires later we will create an event
tag but that should fire at least a bit later than the Google tag because Google tag contains some settings that are important for other Google analytics
tags so select initialization all pages then let's name this for example I will call this G4 config and then save it
congratulations now you have created your first tag the next step is to test if it is working properly to test your setup click
preview in the top right corner then you will be asked to enter the URL of the website do that and click connect once the tag assistant has
connected you can go back to this tab right here and on the left sidebar you can see different stages of the page loading process consent initialization
is related to certain consent settings for example did the user give consent and so on but this goes out of scope of this particular tutorial then we have
initialization that's where we set our tag to Fire and as you can see if I click initialization I see in the tags fired section that my tag succeeded it
is possible that instead of Google tag you see unnown tag type don't worry this is a bug in the preview mode but it does not affect how your tag actually works then we have other page loading steps
for example this is related to the Google tech manager container then this is related to when website elements on a page were rendered and then window loaded means that all tracking codes and
all scripts in General on your website and all resources have loaded if you sometimes see this warning don't worry you can just go back to the website and Google tag assistant will reconnect at
the top of the tag assistant you can see what kind of Google's resources were loaded so you have Google tech magic in here but since Google analytics was also loaded you can see that right here and
if you click it you will see what kind of things related to Google analytics happened on a website so when G4 was loaded it sent a page view to GA but now
let's go back to the container if certain interactions happen on a website and Google tech manager is capable of tracking them those interactions will be available here right now we have five
Google tech manager events but as you progress you will learn that there can be more right here when you select a particular event for example initialization you can see what kind of
tags fired and did not fire right now we just have one tag which fired so we see it right here but if I click on Dom ready on this particular event our tag
did not fire but this is expected because we want our tag to fire only on initialization and that's how it behaves then if you want you can also switch
while having the event selected to variables these are Google tech manager variables that are available in your container and you can see what kind of values did they contain at that
particular moment because their values might change as you navigate between different events then there is data layer tab but this topic is a bit too advanced for this particular tutorial
then we have consent again this goes out of scope of this tutorial and then console so if a certain tag did not fire maybe it threw some error then take a look at the console maybe you will
notice that the console shows some error that will give you more information why a certain tag failed anyway let's go back to the Google analytics tag on the
initialization our tag fired if you want to see why it fired you can click it and then here you will see the firing conditions if there is a green check mark it means that that particular
condition was met this is displayed as a technical variable but you can switch from names to values to see what happened and we see that GTM init which
is a technical name for initialization equals GTM in it this condition was met therefore our tag fired and this Google tag was loaded now the next step of the
testing process depends on what kind of platform you're working with we are working with Google analytics so even though the tag fired here you always must check if the data actually reached
its destination in our case that's G4 so if you have enabled Google tag manager preview mode the tag has fired then the next step is to check debug View in Google analytics 4 it is a dedicated
section to check the incoming data so let's go to Google Analytics and then go to admin panel and keep looking for debug view in my case the debug view
still does not show anything with new properties that might happen I don't know the exact technical reason but maybe there is some delay in that case it might be a good practice to just try
to refresh the page maybe try to refresh the debug view if that does not help then you might need to wait for a bit and then eventually that event should appear and as I speak as you can see we
got the event all of these events were tracked automatically so this is our first visit that was tracked by this property then there was a page view and the session started then I refresh the
page therefore I also have another page view right here if I click it I can see what kind of information Google analytics tracked automatically including page location which is the URL
visible right here also there are things such as page title which is visible right here in the tab so that was the testing process in general enal if you are working with another platform for
example metap pixel or maybe another vendor then this final step which is related to debug view might differ some vendors might have real-time debugging
features some might not so it depends on what are you're using but when it comes to Google analytics always check if the tag fired and then always check if that
data is visible in the debug view once you made sure that your setup works the next step is to publish these changes live because right now what you
are doing here and whatever happens in the prevote is happening only to you in your browser your website visitors who might be browsing the site they are still not getting Google analytics
tracking code loaded to them so to make these changes public you need to click submit and then this will create a new version it's a good practice to give at least a name to the version because
later as the time goes by you might have tens or hundreds of versions so if you don't give names to versions you will just see version one version two version
three and it will be difficult for you to find when a particular change was implemented in the container so give it some brief description for example
installed ga4 and then click submit once the container is submitted a new container version will be created previously we were working with version
one now it's version two and if we go to the versions tab right here we will see that the current version is live life means that this is live to your website visitors and latest means that this is
the version that you're working with in the workspace if something goes wrong and for example this version broke something and you have to quickly roll back you need to complete two things the
first thing is that you will need to publish this I mean the first version click three dots publish and then hit publish right here here then the previous version will be loaded to your
website visitors and then if you want to redo certain things by using the first version as a basis then click three dots right here set as latest version and
then set as latest version right here you might get also a notification to update the workspace so do that and then what will happen is that all the items from the version one will become
available in the workspace and you will not have items from version two or if you just want to quickly fix something in the version two then again publish
the first version then do the changes in the version two and once you publish by hitting the submit button that will create a new third version so each time you publish it will create a new
container version and now as I have installed Google tag mager container and some data is Flowing now it tells me that the container quality is
excellent if you go to tags in Google tag manager click new and then tag configuration you will see a bunch of different tag templates available however they don't cover all the
possible use cases that you might have for example what if you want to implement Facebook pixel which is also known as metap pixel so you could try to use the search feature and then keep
looking for Facebook or meta but you won't find any because these are predefined by Google luckily there are other options how to install tracking codes for example you could go to the
community template Gallery you can either go to it by clicking here or you can go to templates and then in the tag templates section click search Gallery
it will open the same thing here you will see a huge list of various templates built by the community let's say that you want to install Facebook pixel then you can click Facebook select
for example this template then add to workspace add and the template will be added right here from this moment if you go to tags and click new in the tag
configuration you will see Facebook pixel in the custom section this tells us that this was added from the gallery and now if I click here then I could
enter certain settings and then fire this pixel for example on all pages or initialization all pages now we are not going to look into what you should enter in these particular Fields because that
goes out of scope of this tutorial but my goal in this section is that I want to show you that you can add custom templates to your container if you have
a need for that now there might be some situations where you looked at the built-in list of tags and there are no templates then you went to the gallery
but inside that Gallery you also don't see that particular template even though you used the search feature so in that case you can add custom JavaScript code
with the custom HTML tag template so let's go to tags new tag configuration and here you have custom HTML so the code here can be JavaScript but it
should be surrounded by Script tags like this or maybe you already got some custom code that already has them in that case you don't need to enter them
once again let me show you a very simple example let's say that I want to add a banner at the top of the page that says something about about a sale now ideally
these kind of codes should be added directly to the code of the website and that should be done by a developer because keep in mind that Google tech manager can be blocked for certain
visitors if they are using some ad blockers or other extensions that are more privacy focused then Google tech manager will not load to them which means that whatever you have in the
container will not be displayed or will not work for them but if you have this in mind and you think that this is still better because the developer right now
is not available and he cannot add that code then here's a code snippet that I have this is just a very basic example that could be added to the website
however another caveat is that you really really must know what you are doing because just blindly copy pasting some code that you found online or that
was generated by AI it can break your website so if you have some code that is Thoroughly tested it works well and your only option to add it to the website
right now as a temporary solution is Google tag manager then you can use custom HTML tag so this will add a banner at the top of the page saying
something about a Black Friday sale now in the triggering let's say that I will fire this on all pages and then I can call this chtml which stands for custom
HTML and then promo Banner for example and hit save now if I click preview the page will reload the tag
fired this time it fired on container loaded because all pages trigger means all Container loaded events and again ignore this unknown tag type after a
while maybe after several minutes this will be displayed properly if I refresh the preview mode again and now on the website I have this bar right here but
as I've said just a reminder ideally these kind of things like banners or chat Widgets or whatever they should be added directly to the source code of the
website by a developer we are using Google tech manager here as a temporary duct tape solution because we don't have any other options how to quickly add a
banner so we accept the risks that for some visitors this Banner will not be displayed and then once we made sure that everything is working fine the code is working then we can publish a new
version by submitting the container changes one last thing for this section that I wanted to mention is that as you can see from this example not all codes
that you add to Google tech manager have to actually track something this code does not track anything it just adds a particular element to the page so when it comes to tags in Google tag manager
you should think that basically they are Snippets of code that do something that something might be related to tracking but it can also might be related to
other situations or other goals that are not related to measurement every interaction that Google analytics tracks is called an event and when it comes to event
tracking there are several types first of all Google analytics will track several events automatically such as session start or first visit or user engagement then there is a feature set
of other events that Google analytics can track automatically and that is called enhanced measurement if you want to see what kind of events can be tracked by enhanced measurement go to
Google analytics then admin then data streams select your website data stream and here you will see the enhanced measurement section by default it is
enabled and if you want to see what kind of events are tracked you can click this icon so out of the box Google analytics can track when someone Scrolls below the
90% of the page height then when someone clicks a link L that redirects visitors to another website then site search form interactions although I have to admit
that this is not very accurate that's why I usually keep this disabled then it can track embedded YouTube videos on your website and can track when someone clicks a link that downloads a file and
there are certain file types supported like PDF Word documents Excel and so on so since I disabled form interactions I will click save now let's take a quick
look at how this Works in action I have already enabled the pre mode maybe I should refresh it to fetch the latest version of the container and then here I
can scroll down to the bottom of the page like this then if I go to the debug view then I will see that event right here I can click it and one of the
parameters which is related to this particular event is percent scrolled which is 90% because that's when this event is automatically tracked but these
automatically tracked and enhanced measurement events obviously don't cover various use cases such as purchase tracking add to card and so on for that case Google has a list of recommended
events these events are not tracked automatically and you would either need to implement some custom setup or maybe your website has a deeper integration with Google analytics or Google tech
manager and these events could be tracked below this video I will post a link a documentation about recommended events this is the list of events that
you could Implement on your website and Google recommends that you do so for example if you want to track purchases your event should be called purchase and if you want to can click it to see what
kind of additional parameters you can send with them so all of these are recommended some of them are required if you decide to implement this for example currency is required you don't have to
follow this naming convention for example when it comes to form submission tracking or login but when it comes to sales I would say that you must use these kind of event names for example
purchase add to card view item because these event names affect certain metrics in Google analytics and if you implement something else like order complete then your Revenue metrics will not be
populated properly and then if you have some event in mind that you want to track but it is not covered by automatic event tracking and has measurement or it is not mentioned in the list of
recommended events then there is a fourth group of events which is called simply custom events for example if you have a booking form on your website and you want to track when your visitors
book a call with you then you could come up with a custom event name which is let's say booking confirmation or something like that the only thing that I would emphasize here is that when you
track custom events their naming convention should be similar to what Google is already doing which means that event names should be all lowercase and then instead of spaces you should be
using underscores and then finally when you implement event tracking and by the way we will soon look how can we do that with Google tech manager so when you collect event data that event data will
become available in various sections of the Google analytics 4 interface for example you can find the list of events in engagement and events but as I've
said the sidebar is custom iable so in your case maybe you have another location where this event is located but keep in mind that Google analytics needs
some time to process the data even if you have sent event like an hour ago it will still not be available in the reports usually ga4 requires from 24 to
48 hours to properly process the event data another location where you can find event data is in acquisition traffic acquisition and then here you would see
the traffic sources and one of the columns will be events but it's not available by default probably Google changed that so if I customized the
report and added a metric called event count no it is right here so maybe I missed it oh it is okay sorry basically what would have happened is that if you
had some event data right here under the event count you would see this drop down right here where you could see all events that were tracked by your property for example here's another demo
property that I have and here I'm still in the acquisition and traffic acquisition and here I have traffic sources and one of the columns is event
count and here I can see what kind of events were tracked by the property and I can click for example here and see how many form submissions that I get from each traffic source
before we learn how to send custom events to Google analytics 4 first it is necessary to understand the triggers so let's take a closer look at that let's
go to triggers and then click new click trigger configuration and here you will see types of events that are supported by Google tech manager these are the
five page loading stages that you saw in the previe mode in fact let me open the previe mode again this time I will use this let's say URL and then click
connect and if I go back to the prev mode I will see five events consent initialization initialization and everything else so these five events
correspond with five trigger types that we have right here if you want to fire your tag on window loaded which means that all resources on the page have been loaded then you would need to choose
this and then your tag would fire right here then we have click related triggers if you want to track clicks on some links then you will need to use the just links trigger but if there are some
clickable elements on a site that you want to track and they are not links then you will need to use all elements then if you want to track when a certain
element appears on the screen there is an element visibility trigger this might be useful if for example you want to track when a success message appears on the screen then there is a built-in form
submission trigger but it's not very reliable so on some forms it will work but on many of them it won't that's why I usually use other form tracking methods one of the examples could be the
element visibility Trigger or I can track an event on a page view where page URL contains thank you or thank you for signing up or something like that then
we have scroll depth trigger so if you want to track when a visitor Scrolls below 50% of the page height you could use this trigger then we have a YouTube video trigger so it will track embedded
YouTube videos on your website and here you have more customization compared to the enhanced measurement that's why I often disable enhanced measurement video
tracking and I implement this trigger instead then if you have some custom event that was made available by a developer on a website you could use the
custom event trigger but this goes out of scope of this tutorial then if the page does not reload but the URL changes you can track those URL changes with
this trigger if some unhandled JavaScript errors occur on a page then you can track that with this trigger if you want to fire a tag let's say 30
seconds after the page loaded you can use the timer trigger but keep in mind that on every page load the timer trigger resets and if you want you can
combine even several triggers into a trigger group for example you can fire an event if a visitor spends 30 seconds
on a page and Scrolls below 50% of the page height so by combining these two triggers you can create a trigger group let's take a closer look at one event tracking example and we will do that
with the just links trigger first I will click this trigger type and we will create a trigger right now it will fire on all link clicks that's why I will
call this all link clicks like that and hit save then I will click preview to refresh the preview mode and then on this page I have three links I will
click the first one this will open a new tab then let's say the second one and here in the previe mode I will see two link clicks it is possible that you
might see four link clicks this means that one link click is coming from the Google tech manages trigger and the other one is coming from the enhanced measurement if you have enabled some
link click tracking features there but don't worry in my case I have two clicks because I click two times so it's okay now if I click the first one I will see that no tags fired that's okay because
that trigger is not linked to any tags we can even see tags zero but if I go to the variables while I have selected link click I will not see any click related
data I mean I don't know what is the text of the link that was clicked what is the URL we have the Page information but not click information however if you go to the data layer you will see that
info we have the URL that was clicked we have the text that was clicked we even have the class of the link because on websites elements might have classes and IDs so it looks like Google tech manager
can fetch this kind of information this was made available because we enabled link click tracking features in GTM but we cannot use this in our tags or
triggers because we don't have any variables luckily since we are using a builtin link click trigger which is just links we can also use built-in and click
variables let's go to variables then in the built-in variabl section click configure and here we have all sorts of built-in variables that are by default
disabled but we should tell Google tech manager that we want to use them in our setup that's why we will enable all click related variables now let's
refresh the pre mode so that we could fetch the latest version and then if I go to the website click the link let's say the first one then the next one I
will close these tabs and I go to the preview mode I will see that on this link click if I go to variables I will now have the click information that is
available for that link I see the click Text of the first menu link item then the second text their URLs also differ
slightly so this is working fine on some websites elements might have classes so I have this class I don't have any ID but on other websites you might have IDs
but it's also possible that you might not have classes that's when you know you would need to adapt and you would need to learn more advanced topics but this goes out of scope of this tutorial
and this was the basic introduction to event tracking with Google tech manager you know how to enable event tracking capabilities in this case we enabled link lck tracking but now we need to
learn how can we send this link click information to Google analytics and we will learn that next let's continue the previous examples with these links let's say that this is
a website menu and I want to track every time someone clicks on them I want to understand which links are clicked the most I already have enabled the link click tracking features in Google tech
manager because I have a link click trigger right here but if I added this trigger to a tag it would fire on all links on a website now I want to track
only these links so let's see what kind of information can we get about these links so that we could narrow our trigger down that's why first of all I
will go to tag assistant I will clear this stream right here and then I will click the first link second link and a third link now I will close these tabs I
don't need them and let's go to the tag assistant and check those three link clicks I want to find some common things among the those links if I click the
first link click and then go to variables I will see that its click classes is menu link while other values might differ for example the text Will
differ now on the second link click the class Still Remains the Same and here the class also Remains the Same so technically I could make my trigger more
precise and configure it to fire only when the click classes equals menu link so let's do that I'm I will go to Google tech manager open my trigger and I will
make it more precise let's click the pencil and instead of all link clicks I will select some link clicks and I want this trigger to be activated only when
click classes contains or maybe even equals the menu link without quotation marks so copy this and paste it right
here then let's rename this trigger to link click menu item or something like that and hit save so the trigger is now more precise let's create a tag that
will send an event to Google analytics for let's go to tags and for every event or maybe group of events that you want to send to Google analytics you will need to create a tag the type of that
tag will be ga4 event so let's click new tag configuration Google analytics and then ga4 event here we have to enter the measurement ID that measurement ID can
be found in the ad admin panel of Google analytics so let's go to admin then data streams website data stream and then copy the measurement ID baste it right
here and then we have to come up with some event name if you check the list of recommended events or automatically tracked events you will not find anything related specifically to menu
items that's why we can call this event however we want for example menu link click like that then together with this event we should also send some additional data because just the fact
that we have this event will not tell us which links we clicked the most so let's take a look at what we have in the preview mode we have things like click Text and we also have click URL so maybe
we should send them to Google analytics because then we will know which links were clicked the most that's why in the tag we have event parameters section and
here we can include additional event parameters below this video you will find a link to documentation of enhanced measurement and here you will see what kind of events are automatically tracked
and their parameters so I don't see the reason why we should not reuse them let's reuse them for example we could reuse link URL for the URL of the link
and then we can also send link text because at least most of these parameters are automatically recognized by Google analytics so I will go to
Google tag manager and we'll enter link text and you can even see the check mark that this is a known parameter for Google analytics and then we can add
another parameter which is link URL now what kind of values should we insert here if we just type something like menu link one it will be a static text and
every time this tag fires we will get the same value now we want to fetch the value dynamically and as you can see if we look at the click URL on this event
and then on this event there values are changing so we can use variables to dynamically fetch certain values that's why we can go back to Google tech manager and instead of this static value
we will insert a variable click this button and then select click Text so click Text value will be used for the link text parameter then let's do the
same thing here and select click URL when this tag fires Google tech manager will fetch these values and will insert them as values of these parameters and
this will be sent to this data stream now the triggering that's the easy part we already have the trigger so click anywhere and select link click menu item
finally let's name this tag I usually name them like that ga4 event and then the name of the event click save the tag is created Let's test it click preview
to refresh the previe mode preview mode has connected let's go to the website and I will click the first link link second link third link I don't need these tabs so I will close
this and then just for testing purposes let's click one more link for example I will click this this is not a menu link so I would expect my tag to fire on this
link let's go to the previe mode and here we see four link clicks even though remember we configured our trigger to fire on menu links so we expected to see
three link clicks now let's see what is happening I click the first link click the tag fired on this the tag fired and on this the tag fired as well so these were menu link clicks but on this the
tag did not fire now this is how event tracking is working in Google tech manager if you configure a certain trigger it might fire more but what's important is whether the tag actually
fired because of that event I don't want to overwhelm you right now with too many like technical details but here what's important is that the tag did not fire so this behavior is correct you will
keep seeing link clicks on all link clicks that happen on a page but your tags must fire only when their conditions are met for example here if I
click on this click on a tag and then I look at the conditions you will see that the click classes was this and the condition was met then we were looking for a link click event and that's
exactly what we got and ignore this third option because it's more Technical and that's just how triggers work under the hood in Google gole tag manager and
if we switch to values we will see what is happening and this is working ignore the bug right now if I waited for I don't know maybe several more minutes and then Reloaded The prevote it would
be displayed properly in fact that's exactly what happened just now I paused the video I closed both of these tabs and I launched the pre mode again and
now I see the tag type correctly so if I click the link right here and then I go to the previe mode select link click and since the tag type is now recognized
properly I can click it and I can see what kind of things were sent to Google analytics since I have switched to values I can see that together with this event we are sending this parameter and
this was its value the same applies to this parameter and this is its value everything is working properly now the next step would be to check the debug
View and verify that these events were received by the property so let's go to admin then data display debug View and
here we have that event we should have more somewhere we don't see it because sometimes there is a weird delay in the debug view eventually those events
should appear or if you wait for 24 or 48 hours they would definitely appear in the reports let's see what we have in this event so we have some automatically
tracked stuff and also we have our two parameters and their correct values now if you're wondering where can you see that data layer in Google analytics 4 reports I don't have enough data in this
property because it's brand new so I would need to wait for at least 24 hours but I have some older demo property from the past so let me show you one of the examples or one of the places where can
you find that data but if you want to learn much more about Google analytics 4 or how to find data how to build reports then take a look at my Google analytics 4 course I will post a link to it below
the video so let's go to explore and then we will click blank here we want to see the top menu links that were clicked and how many times each link was clicked that's why we will Click A Plus in the
dimensions section and we will add link URL click here ignore this one that's just my testing and then enter link text
and select it right here finally we will also need to filter down just to menu link click events and we will do that by event names sorry not event count event
name and select that click confirm then let's add a metric for now it will be enough just to have event count and then click confirm finally double click on
this Dimension this Dimension and then this metric right now this report includes all events which means that not only menu link clicks but also maybe I have some other events and if we want to
narrow down just to menu link clicks we can do that by going to filters and then selecting event name exactly matches and
then type menu link click and then apply now I don't have any data because those menu link clicks happened way in the past right now I'm looking just at the
last 28 days but if I change this to let's say last 12 months and then apply I will see the data this is the link URL this is the link text and how many times
this link was clicked now you have a better understanding of what Google tech manager is how does it work and how to create your first setup but keep in mind that this is just the very beginning of your
journey there are many other things that you will need to learn about Google tech manager that's where my full course for beginners will help the video that you are watching right now explained around
10% of what a beginner should actually know about Google tech manager the rest 90% are explained in my course which is called Google tech manager master class for beginners I will post a link to it
below the video if you found this video useful hit the like button that will help me understand what videos do you like and what should I create in the future also if you want to learn more
about Google tech manager or ga4 then subscribe to this channel my name is Julius this is analytics Mania and I'll see you in the next video
[Music]
Loading video analysis...