Google Tag Manager Tutorial for Beginners (2024) with New Google Tag

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you are a digital marketer or digital analyst and you want to implement marketing and analytics tracking codes much faster for example Google analytics then Google tag manager is exactly what you need but how to get started how to properly create your first setup without wasting too much time looking for the right learning resources in this video I will show you that we will learn how to get started with Google tag manager how to install Google analytics 4 and more Google analytics and Google tag manager are constantly changing that's why this is probably the third version of this tutorial on my YouTube channel but I'm just trying to keep this updated but if you notice some major differences between this video and what you see in your screen then take a look at the description of this video I might have some updates there so what is Google tag 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 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 match 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 tag manager Works in a nutshell you have a website and your developer installs Google tag 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 matcher 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 are less dependent on developers this does not mean that Google tag 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 tag manager is very popular it still continues to grow this means that there are various learning resources in different formats like blog 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 but before we continue I wanted to give you some quick disclaimer this Google tag manager Learning Journey will get confusing at some point point and that is okay don't worry some topics are more technical but they are necessary for you to learn so in the beginning of your journey you will have no idea what you're doing but then later I will start showing you some things and you will try to repeat them after me in order to understand how this works and eventually you will become like Neo who started to believe in his powers and then he was able to solve various challenges fairly easily foreign to get started with Google tag manager go to tagmanager.google.com or just enter in Google search Google tech manager and then probably the first link will be the one that opens GTM then if you have never worked with Google tag manager before you will see something like this where you're asked to create a new account but if you already have at least one account and container then you might see something like this so now I will click create account and here there are two key components accounts and containers account is basically a business so if you are working as a company and you have multiple websites you would need to have one account and then in that account you can have multiple containers containers are like buckets where you store your tracking codes you can have separate containers for each website or you might even have one container for multiple websites if that makes sense in your context so here let's say that I will call this analytics Mania GTM fundamentals or something like that and then in the container setup I will call this let's say demo container and in this mini course I will be focusing on website tracking that is why our Target platform will be web click here and then click create then you will need to agree with terms of service and now you have created the container if you prefer charts or visual explanations then let's take a look at this again when you want to access Google tag 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 tag 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 codes that you are going to use are pretty different than I would recommend creating separate containers for each website this is the interface of Google tech manager on the left sidebar you will be able to access your tags triggers and variables later I will explain what they are and what kind of purpose do they serve so every time you want to create let's say a new tag you would need to go to tags then click new and follow the process you can also organize your tags triggers and variables in folders for example you can have all your Google analytics tags in one folder then let's say Google ads tags in other folders and so on templates are a more complex topic basically you can import certain templates from the gallery that is powered by the community of web analytics Specialists so for example in the tag templates section you could click search gallery and here there is a bunch of different templates that you can use for example if you want to install Facebook pixel then you can enter Facebook and here you will find several options in the top menu we have workspace that's where you will be spending most of your time because that's where you manage tags triggers and variables then there is versions so every time you publish your changes in the container you will create a new version the cool thing about versions is that later you will see a list of all previously published versions and for example if you launch today a new version of your container and something goes wrong maybe something is not working then you would be able to quickly roll back to the previous version that was working and then while you are clear-minded and there are no problems on the side you can fix the issues and publish yet another new version of Google tag manager container you can publish the previous versions by choosing that previous version and then going here clicking on Three Dots and clicking publish then there is the admin section where you can manage things such as user access on the account level or you can manage users on the container level you can also change some settings in the container itself but there are not many changes here mainly the container name and some Advanced consent related stuff then here you can access your Google tag matter tracking code once again you can also export container for example if you have the same setup that you want to apply in a different container then you can export this container go to that other container click import and import the file of that container which is also pretty useful and there are some other options here but they go out of scope of this lesson because they go a bit more beyond the beginner level let's go back to the workspace so here in the workspace when you do some changes they will be visible right here and before you actually publish them you will need to test them and this is highly recommended so to do that you will need to click the preview this will open the preview mode and later we will use that and this will help you to test your changes but only within the boundaries of your browser so that means that the untested changes will still not go live to your visitors until you say so and once you make sure that everything is working fine finally you can click submit and publish a new version meaning that all these recent changes will go live to your website visitors as well also one more place where you can get your Google tag match your container code is by clicking on the container ID right here and you will get these codes very soon I will show you what to do with this code but as for the overview of the interface that's about it foreign Google tag manager container the next step is to install it on your website there are mainly two ways how to do that and they depend on what kind of content management system are you using on your website the first option is to click this container ID and then give these two codes to your developer of the website the first code should be added to the head of the website and this code is required for Google tag manager to work and the second code should be added to the body of the website code the developer will know what these two are the second code is optional you don't need to install it but if you care about things such as Google search console property verification with Google tag manager then this code will be useful so the process for the developer would look something like this he or she should copy this code and then go to the source code of the website and add it to the head it is perfectly fine to add this code before the closing head tab tag the one that has this slash right here but if your content management system does not allow you to edit the head of the website and only allows you to edit the body then Google tag manager will also work if this code is added somewhere to the body now when it comes to the second code it is highly recommended that if you decide to add it to your website it should be added right after the opening body tag so here we see the body and then the code should be placed immediately after that so once the developer saves these changes then Google tag manager will be installed on your website however if you are working with a popular content management system there is a very high chance that maybe that system already has a built-in Google tag manager support or maybe there are some plugins that you could add to the website and that plugin will help you install Google tag manager faster for example if you're working with WordPress there is a very popular plugin called Google manager for WordPress so once you install that plugin it will appear in the settings of the WordPress and then click Google tag manager here it would be enough to just add the container ID so you can get the container ID from this tracking code right here so once you copy it and you paste it here and then in this case you select codeless injection and save changes this will install Google tag manager but again remember that the process of installation will differ in other content Management Systems so you will need to adjust once the developer tells you that the Google tag manager container snippet is installed on the website you need to check if that is done properly the easiest way to do so would be to go to Google tag manager interface click preview then enter the URL of the website where Google tag manager is installed and click connect if you see that tag assistant is connected here and here then it means that Google tag manager has been installed properly in my case Google tag manager preview mode opened in a separate tab of the browser but in your case it might open in a new window personally I think that it's much more convenient if the preview mode opens in a new tab that's why I would recommend that you install a tag assistant companion extension I will post a link to it below the video it is available on all chromium-based browsers for example Google Chrome and once you install it then the website where you're debugging your GTM setup will start opening in a new tab if that extension for some reason is not working then there is another extension called Google tag assistant Legacy I will post a link to it below the video as well oh and one last thing that I forgot to mention is that the developer must add this Google tag manager code to every page of your website because then Google tag match will work only on those sites where this container snippet is added if you or your developer adds it only to the home page Google tag manager will work only on the home page foreign 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 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 Google tag 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 tags 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 your 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 the 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 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 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 tag manager is not here 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 foreign Google analytics is a platform that allows you to measure how visitors are engaging with your site or how users are using your mobile app in this mini course we will be focusing on website tracking so very soon I will show you how to install Google analytics on a slide with Google tag manager but now let's take a quick overview of Google analytics 4 and what can it do for you so once Google analytics 4 is installed you will start getting some data about the user behavior for example if you go to reports then you will see a bunch of different reports here in your case the list of reports might look different depending on what kind of settings do you choose in Google analytics but in my case I have these reports so for example if I want to see where my visitors are coming from then I could go to acquisition and traffic acquisition and here I can see Channel groups but many people prefer to use the session Source medium so here you can see that for example a lot of traffic is coming from Google search they are also coming from Paid advertising some things are not tracked properly because Google analytics is not installed properly on this demo account but you can still see what kind of data can you get you can also see a layer if you implement additionally e-commerce tracking you can then see how much revenue did you get from each traffic source as well then Google analytics also can track things such as page views and that is done automatically so here we see what kind of pages are most popular how many page views did they get how many users viewed those pages you can also switch between dimensions and for example change to page path and so on then a very important component of Google analytics is event tracking when something happens on your site for example a visitor submits a form you can send that form submission event to Google and analytics for and that's where other reports such as events can start populating data for example here a lot of people saw some internal promotion maybe a banner on a website then we see the page view counts and so on and if you're selling something on your website and you track that with Google analytics and then monetization reports will show you some additional data for example e-commerce purchases here we see the top products but the number one is tracked incorrectly so that's another problem of this property but here you can see that this product for example has been seen this many times then the add to cart probably unfortunately did not work properly I mean the tracking did not work and then this is how much revenue did we get from that particular product we can also sort if you want and these are the top products based on item Revenue then there are more advanced reports where you can explore the data that you have and that is available in the explorations even though we have a bunch of options here personally I most often use these three which are free form funnel exploration and path exploration so freeform exploration is basically like a table where you can visualize data of course there are some charts but I mainly use it for tables then the funnel exploration where you can define a particular user journey and then you can see how people are dropping off at which step and then you can also use the path in your explorations to see how people are navigating between different pages or in what order particular events are happening so if you click the freeform exploration here we have one example where we see the top settings divided into device categories and how many users do we have in each combination then we can take a look at another example which is funnel exploration so I will click blank here I will select let's say final exploration and here I can create a sequence of events by editing the steps so I click the pencil and let's say that I want to see how many people saw the item so there's an event view item this is not automatically tracked by gigonometers 4 you have to specifically send this event with developers help or with Google tech manager then the next step could be add to cart then the next step could be begin checkout and then the final step could be the purchase now if I click apply and maybe I could select a longer time period here I will see that a lot of people see at least one product but 99 of them don't go to the next step which is adding a product to a cart but I could zoom in by scrolling up or by using these icons right here and then I can see that out of those who added product to a card 58 did not start a check account so we also see some completion rates here and again this is just a very very brief overview of Google analytics and I will not dive deeper into what can you do with this data because that's not the purpose of this mini course and then the final example could be the path exploration where you can see how people navigate and in what order on your website so I will start over and then I will select the starting point which is the page path and that page path is this so this is a home page and even though again this is not tracked properly because Google analytics is not installed very well on that demo shop the second most popular page is the sign in so I can click on this and see what other Pages the visitors usually visit after that so we have store I can click here and I can Branch out and see the most popular paths that my visitors are taking also another cool thing is that I can start over and start from the ending point so for example I can choose the order confirmation page and then I can go backwards and see what my visitors visited or what were they doing before they made a purchase so if you click here and then select let's say page path and enter the page path of your order confirmation page you would be able to do the reverse pathing so in the next part I will explain how to install Google analytics 4 with Google tech manager foreign let's create our first tag if you don't have a Google analytics 4 property yet then go to analytics.google.com and if you are completely new to Google analytics then you might see a view that looks something like this so here you will need to enter your company name and then click next but if you already have at least one you've got analytics for property then you will need to log into any of those properties and then go to admin and then click create account here let's say that I will enter analytics Mania demo then I will click next and the next step is to create a property this is like a bucket where you will store the data about your website or your mobile apps so I will also name this analytics Mania demo you can enter here let's say the name of the website for example make sure that you select the correct reporting time zone of your business your currency and click next then you will need to answer several questions click next and just to streamline the learning process for now select this option right here because then you will get a set of standard reports that have been around in Google analytics 4 for a while but in the future if you want you can select other options because based on your choices right here you will see a different set of reports on the left sidebar of Google analytics so now let's choose Baseline reports and click create then agree with terms of service and now you will be asked to start collecting data data collection in Google analytics 4 starts with data streams so these are the ways how you can send data to ge4 if you're working with the website you will need to select web platform if you plan to send data from mobile apps then you will need to select these other data stream types right now let's select web here you can enter the URL of the website in my case I will enter my demo website and my paid Google analytics and Google tag manager courses my students have access to demo sites where they can practice in action how to work with GTM and ga4 and here I can enter something like my website this is working fine so the next thing that Google analytics asks you to verify is automatic event tracking because ge4 tracks not only page views but it can track some additional events for example site search video engagement which is the embedded video player and I mean YouTube video player on your site file downloads and so on personally I never found useful form interactions because they cause a lot of false positives that's why I will click the gear icon disable form interactions click save and then I will create the stream now Google analytics will ask you to install the code but we are going to use google.com mattress so we don't need the entire code close this and instead we will need just the measurement ID by the way if you're completely new to Google analytics 4 I have a one hour tutorial about it where I talk about more details so if you want to watch it then I will post a link below the video so now what we need to do is to copy this measurement ID so click this icon and now let's go to Google tag manager tags click new tag configuration Google analytics and then select Google tag here we have to paste the measurement ID then click triggering and select initialization all pages you might find some older tutorials that tell you to fire on all pages that will also work fine but the current recommendation is to use the initialization then let's name this tag and click save so now we have created our first tag in Google tag manager when you do some changes in the container don't hit submit right away first you need to test if those changes are working properly so now we need to check if Google analytics 4 is activated on a site properly so click preview then enter the URL of the page where you want to test this and click connect once you see that the tag assistant has connected go back to the tag assistant Tab and here click container loaded when we set the tag to fire on all pages it means all Container loaded events and here we see that in the text fired section our G4 tag has successfully fired so that is a good start now let's check if that data has been received by Google analytics so go to ga4 then admin and then keep looking for debug view here you should see your events if you don't see them yet then wait for a while because for new properties it takes a bit more time time for the debug view to start working but in my case here I have the page view I can click it and I see parameters that were sent together with that page view I can also expand those parameters for example page location and I see the URL of the page where that event happened and this is the same URL that is visible in the browser address bar so everything looks good now let's take a very quick look at the preview mode so here on the left side you see the stream of Google tech manager events these are not Google analytics events this is related to Google tag manager and if for example some clicks happened or some purchases and that data is pushed to the thing called Data layer which is a bit more complex topic then you would see those interactions on the left sidebar and you could use them as other conditions to fire your tags later I will show you one of the examples if you have multiple containers installed on the same site you might find there container IDs here but right now we are working with this one then when you're debugging tags you can click the event on the left side where your attack was supposed to Fire and then you can click on the tag itself and this helps you troubleshoot for example maybe the tag did not fire when it was supposed to or vice versa so in this case we see that the tag has fired we see the triggering condition that caused this trigger to be activated and then the tag was fired you can switch between values and names because these little blocks right here show the variables in Google tag manager so all in all Google tag manager preview mode should become one of your best friends when it comes to tag management because it will help you troubleshoot various situations if your tags are not behaving the way you want them to soon we will also take a look at the variables and the data layer tab but for now let's keep it as it is if for some reason you start working with your setup and you don't know what is wrong and you need help then it is a very good practice to ask for help but when you do that also share the link to your preview mode with others so you can do that by clicking these three dots then click share then make sure that you're debugging Google Tags and your Google tag manager container and then enter the URL of the page where you're testing this once all of these are selected copy this URL and share it with another person who is willing to help you this will definitely increase the speed of troubleshooting and you will get help faster when you made sure that your setup is working fine and your changes are properly working then the next step is to publish these changes so that your new configuration would go live for website visitors as well and to do that you should click submit and here a good practice would be to add a quick version name because if you skip this step and then after one year you come back to the container with a bunch of versions with no names it will be difficult for you to find when what change was implemented so I would suggest entering at least the version name if you add some description that's even better in our case we can enter GE for installed and then click publish now the version 2 of the container has been published and it is live for the website visitors you can always find the list of all Container versions in the versions section at the top menu if for some reason let's say that this new version contain in some error and maybe you misconfigured some tags and you quickly need to roll back to the previous version you can do that by clicking three dots on the previous version and then click publish and then click publish again now it will show you that this version is live and the error is no longer loaded on your site and now you can keep working on your container you can fix the issues and once you are ready and let's say that you know everything is configured properly everything is now fixed you can submit a new version so let's say that we will call this ga4 fix or something like that and click publish and now this will create a third version which is live and which is the latest so the latest means that you are working with that version right now and your Google tech manager workspace so this kind of process should be repeated every time you do some changes in Google tag manager first you implement those changes you create tags triggers variables then you preview them with Google tag manager preview mode and if it is possible then use things such as debug view for Google analytics or maybe you are using some other tool that has some real-time debugging features and once everything is tested properly then submit a new version foreign manager you can choose from a bunch of different tag templates so these are called tag templates we have you got analytics 4 Google ads and so on also if you scroll down you will see a bunch of others but what if you want to install a code that is not listed right here in that case you have two options the first option is to try to find a custom template for that that's where the template section might become useful so go to templates then search gallery and then use this search feature to find the tool that you want to install for example in my case let's say that I want to install a chat widget and that chat is created by drift if you have a drift account and you want to find the instructions they tell you to add this kind of code to the website so what I would try to do first is to go to Google stack manager and enter Drift But this talks about drift pixel not about drift chat so I am not sure if this stack template will work for me that is why I would try to use a different alternative which is a custom HTML tag so go to tags click new tag configuration and then choose custom HTML here you can paste the JavaScript code that a particular platform that you want to install asks you to add so in my case I will copy this drift code and I will paste it here when you do that the next part is to set the trigger when do we want this chat to fire if you want to install it on all pages usually you can use the all pages trigger because in most cases that would work so I will select this trigger and then I will name the tag I usually name them like that chtml stands for custom HTML and then add it like this now let's click save and test if this is working I will click the preview then click continue and Go to the page and here I can already see that my my chat widget has appeared and I can send the message here also the tag is fired right here so if you cannot find a custom template or a standard template then use custom HTML now speaking of other templates I mean the custom templates that you might find useful here are several examples for example if you want to install Facebook pixel then you can enter Facebook and then use for example this Facebook pixel template the same can apply to for example LinkedIn so there are many many templates available there and you can use one of them so let me just quickly show you an example of the Facebook pixel so I click that template I add it to workspace and I click add so now the template has been added so now I should go to tags click new tag configuration and then choose the custom template right here and as you can see instead of dealing with the plain code I see some Fields some drop downs radio buttons here I it paste my Facebook pixel ID to some additional configuration and then for a tag whenever I wanted to and of course as always once you test the tags that you have added to your container don't forget to publish them foreign tracking in Google analytics 4 there are several types of them the first one is automatically tracked events for example when a visitor lands for the first time on your website Google analytics 4 will track a first visit event and there are several others such as session start or user engagement then there is a set of features that can track several other events automatically and that feature set is called enhanced measurement you can learn more about enhanced measurement by going to Google analytics then admin then data streams and then click on the website data stream here you will see the enhanced measurement section and here you can see what kind of events can it track you can also click this gear icon to see other events there is a fairly high probability that more events might be added in the future and if you want you can disable some of them or keep them enabled so now let's take a look at how some of these if events work I will go to Google tech manager click preview then click connect and then I will go to the debug view of Google analytics just to show you several events so here I have an outbound link click example let me click that this is a link that redirects the visitor from this domain to another domain and if I go to the debug view of Google analytics 4 I will see an event called click and we can see the link URL this is the URL of the link that was clicked also on one of the pages I scrolled below the 90 of the page height that's why we also see the scroll event I can click it and here we have the percent scrolled also Google analytics can track links that download or open certain files for example PDF file so I can click here this will download the file and then I can go to the debug View and one of the events is file download I can click it and I can see based on the link URL what kind of link and what kind of file was it the next group of events is called recommended events so those are not tracked automatically by Google analytics 4 but you can send that data with Google tech manager or with the help of your developer to ga4 below this video I will post a link to a documentation about recommended events and here you will see a list of them also you can for example click on any of those to learn more about what kind of parameters can you send with them together for example if someone registers on your site Google analytics recommends to send a sign up event you can click and here it will show you a recommended parameter which is not required but if you want you can send it for example this method parameter can mean the way how the user signed up was it with the email address maybe with the Google account maybe with some other account so when it comes to recommended events most of them are indeed recommended I mean they are not required so you can name the sign up event register instead and that will work fine however when it comes to e-commerce tracking event names such as purchase or refund or add to cart those should be named exactly like this and in general I would highly recommend that you follow the naming Convention of Google analytics 4 which means that event names should be all lowercase and instead of spaces you should have the underscores like here for example so if you have something that you want to track with Google analytics for it is always a good practice to check the list of recommended events and then if you find something then use that but if you cannot find it then there is a fourth group of events which is called custom events this means that you can send any event names that you want and you can also include parameters that might be recommended parameters or you can come up with some custom parameters after you send the events to Google analytics 4 then they will be available in various sections of the interface for example reports engagement and then events just keep in mind that when you send data to Google analytics it will take up to 48 hours for that data to appear in the reports alright so since we had our introduction to event tracking let's track our first event with Google tag manager when it comes to event tracking it is necessary for you to understand how triggers work so let's take a look go to triggers in Google tag manager and then click new click trigger configuration and here you will see a bunch of supported trigger types the first five are related to different stages of page loading process for example page view is the moment when Google tag manager starts to load while window loaded means that all resources on the page have been loaded including scripts and images then we have click triggers so just links tracks just links and if you want to track some element that is not a link but it is still clickable then you might want to use all elements trigger then if you want to track when a particular element appears on the screen for example a success message then you might want to use the element visibility trigger then there is form submission trigger but mostly it is unusable because it fires way too often or in some forms it will not fire at all so I would say 99 of cases you will not be able to use this and there are other form tracking methods then if you want to track when someone for example Scrolls below the 90 or 50 of the page height then scroll depth is the trigger that you could use then if you have an embedded YouTube video player you could use this trigger then if you have a situation where none of those triggers work you could ask a developer to add some custom event to a thing called Data layer and then you could use that custom event with this particular trigger the history change is useful when the page URL changes without the page reloading so you could track that then JavaScript error is self-explanatory so if some JavaScript error occurs on a page you could send that as an event to Google analytics then the timer so this applies to a page so if a visitor stays on a page for let's say 50 seconds 10 seconds or so on you could use this trigger and there is also a trigger group which is useful if you want to combine multiple conditions for example if a visitor Scrolls on a page below 50 of the page height and also stays on that same page for more than 30 seconds so you could combine two triggers into one trigger group and only when all triggers in the trigger group are activated then your tag would fire in this tutorial we will be looking at the link clicks trigger as an example so even though Google tag manager offers this variety of triggers they are not enabled by default so you need to actually create a trigger to enable that tracking functionality for example if you want to start tracking link clicks you need to create a just links trigger so let's do that let's choose the just link clicks then I will name this for example all link clicks because for now we are just going to see what is happening in the preview mode and then I will click save now let's see what will happen on the website so click preview to refresh the preview mode every time you do a change in your container and you want to test this click the preview mode and the GTM interface so now I am on a page and I can click this link or this link or this link I was holding the control key on my keyboard so that the page would not reload and here we see a bunch of clicks so even though I click three times I see six link clicks this is a bit confusing for beginners so this is happening because three triggers are coming from the Google tag manager and since we have created a link click trigger we enabled link click tracking capabilities so we started seeing some link clicks here the other three link clicks are coming because enhanced measurement is enabled in Google analytics 4. so that might might be a bit confusing but in general so far nothing was sent to Google analytics because no tag was fired here so far so good now let's take a look what kind of information do we have about those link clicks for example maybe we could fetch the text of a link or the URL of that link then when we select one of these link clicks we could go to variables and unfortunately we don't have anything related to clicks but if we go to the data layer we will see things such as link URL for example if I click here I will see a different link URL there's also text of that link so it looks like Google tag manager is capable of fetching the information about the link but it is not available as variables and this is crucial for us that the data was available as variables because otherwise we won't be able to use that in triggers and tags so what can we do to solve this issue we would need to go to Google tag manager variables and we need to enable a bunch of Click variables in Google tag manager because Google tag matter in general supports click tracking so it has the click triggers but we also need to create click variables so in the built-in variables section click configure and then scroll down to enable all click variables once you do that let's click preview and refresh the page let's do the same thing again so I will click this link then I will click this this I will close these tabs and I will go to the preview mode now let's click the first link click event and go to variables and voila we have things such as click classes click Text click URL some variables are empty because in my case those links don't have click ID but on other websites they might have also on some websites click classes might be empty but in general it looks like this would work fine but but now you might be wondering alright so I enabled link click tracking how can I actually send the data about that link click to Google analytics and that is what we will learn now foreign let's say that we want to track menu link clicks so whenever someone collects any of these links in the menu bar I want to send it as an event to Google analytics so far we have created a link click trigger it would activate on any link clicks so if I just linked this trigger to a Google analytics for tag that would fire on every link click and I don't want that I want to send an event to Google analytics 4 only when these links are clicked so let's take a look at how can we narrow down our trigger to just these link clicks so I will click this one this one this one and then let's see what will happen or actually maybe I should clear the stream right here and try the same thing once again so I will click this link this and this let's go to the preview mode and click the first link and go to variables then click this link for example and this and let's try to find some similarities between those links what kind of variable Remains the Same on all three link Clicks in my case that is Click classes all of them contain site nav link main which means that this is the main navigation bar keep in mind that every website might be coded differently so in your case click classes might be empty or it might contain different values so you will need to adapt but in my example all menu link clicks contain the same class which is what I could use in my trigger so let's go to Google tag manager and edit our existing link click trigger click on the pencil and then click some link clicks and now we can narrow down this trigger with the variables instead of firing on all link clicks I want my tags to fire only on some link clicks where click classes contains and then this part right here like that and then I will rename this trigger to let's say link click menu and then click save so we are done with the triggering part but now we need to somehow send that data and that's where tags are always used let's go to tags click new tag configuration Google analytics and select ga4 event when you want to use just the basic Google analytics for setup which means page views and maybe some automatically tracked events then it's enough to have just a Google tag but if you want to send some additional events with Google tech manager then for those events you should use the event tag so click it and then you can paste the measurement ID then Google tag manager will scan the container and we'll look for Google tags that have the same measurement ID however you need to keep in mind that this kind of process when you will need to insert the measurement ID in tags will happen multiple times because in each tag you will need to manually paste it right here so instead of just blindly copy pasting the ID I would recommend creating a variable that will contain the ID and then in all your feature tags you will be using that variable this will save you some time so let's do that let's cut that measurement ID click the button to insert the variable and then we will create a variable so click plus right here than a verbal configuration and then find constant here you should paste the measurement ID and then we can name this let's say like that and click save so this will insert the variable but we still don't see the green check mark so we could do that by cutting the ID and pasting again because I think that's a bug in ge4 right now because when you insert the verbal from here sometimes it doesn't trigger the validation then let's add the event name it can be whatever you want for example I will name this menu link click but just sending the event name alone is not useful because we want to also know what kind of Link was clicked what was the URL of the link or what was the text of the link that's why we should also send some additional event parameters that can be done by clicking event parameters and then you can add the parameters right here if we go to the preview mode click one of the link click events and then go to variables we can see that we have some data about those link clicks of course if you have enabled the click variables in my case I don't have the click ID but I have click Text and click URL these are definitely useful so I could send them with a manual and click event so let's go back to the tag and we will add two parameters so two rows in total one row per parameter in Google analytics four there are several link related parameters that are supported out of the box one of them is link URL and the other one is link text this check mark right here also shows that these parameters are known parameters to Google analytics and here we can insert the variables that will automatically fetch the information about the link because for example if I clicked the contact link then I would have another link click and here the values are different so Google tag manager will automatically pick the information about the link click in this case it's text and URL and it will insert the data right here so we need to use variables for that let's click the insert variable button and we will insert the click URL variable because this is the parameter that we will send to Google analytics and this is the variable that will help us send the value of the URL so I will click insert variable and then click URL then repeat the process for the link text but this time we will use the click Text variable finally let's scroll down to triggering and select the link click trigger that we have created previously let's name the tag I will call it like that and click save so to sum up when you are going to create more event tags in the future you should use the constant variable that contains your measurement ID that way you won't need to go to the settings of data stream copy the ID and then paste it here you will just need to insert the variable in this field and it will work right away also since we have the measurement ID here why not use that same measurement ID in our Google tag because right now we have the static value so I will remove this instead I will insert that variable which will just pick the ID and click save what I did in the Google tag is not required but it's a good practice Let's test if this is working properly so click preview to refresh the preview mode and fetch the latest update of the container and now let's click on let's say the first link the second link the third the fourth link I will close all other tabs and then let's go to the debug view of Google analytics for or in fact you know what let's go to the preview mode of Google tag manager first so here we have a bunch of Link clicks as I've said half of them are coming from enhanced measurement because it just identified the events but on those link click events the tag will not have fired for example if I click on this one the attack did not fire the tag did not fire here as well but the other half of the events is coming from The Click trigger in our Google tag match container so if I click this the tag has fired here the tag has fired and in fact if you select one of those links clicks you can click on the tag to check what kind of information was sent so the status is fired this tag fired because click classes contains this and this condition was matched then ignore this it's too Technical and it's how triggers work under the hood so ignore that part and here we have the technical name of the link click which is GTM link click so all these conditions were met that's why this trigger was activated and this tag was fired this tag sent this event to this property and it's sent two additional parameters link URL and Link text if you switch from names to values you will see what kind of value was sent with link URL and what kind of value was sent with link text if you check another event and do the same thing the values will be slightly different because we clicked a different link so once you make sure that the tag fired properly now let's go to the debug view of Google analytics 4. so go to admin then debug View and here you will see a bunch of events among them you will see the menu link click as well here we see a bunch of parameters so those were tracked automatically by ge4 but some of them were the ones that we sent which is link text and Link URL so it looks like this is working fine so now what we made sure that this is working fine we can click submit and we can click publish but before that let's name this version let's say G4 menu link click tracking click publish and now this change went live to all the visitors of the website within the next 48 hours the menu link click event will appear in reports engagement and events or if you have different report names and Report structure then just keep looking for some report that mentions events right now again my is empty because not enough time has passed later if you want to see what kind of links were clicked and which ones are more popular one of the ways how to do that would be to create a custom report so you would need to go to explore then choose blank and then do the following configuration in Dimensions you would need to select event name click checkbox then link text click checkbox and Link URL and click checkbox then click Import in metrics click plus and add event count click this and import then drag link text and Link URL or you can just drag one of them for example then drag the event count to values and then in the filters you would need to narrow down just to manually click events so you would need to drag the event name to filters and then make sure that event name exactly matches menu link click and click apply of course the report right now will not show any data but after 48 hours or maybe 24 hours the report will start populating data where you would see the list of all links and you will see their names and URLs and you would also see how many times each link was clicked yes I agree that seeing that kind of basic data takes too much effort in Google analytics 4 but that's just how it works at least right now so if you want to learn much more about how to properly work with reports how to see the data how to find it how to get value out of it then you should take a look at my in-depth Google analytics 4 course I will post a link to it below the video and that's the end of this tutorial now you have a better understanding of what Google tag manager is how does it work and how to create our first setup however 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 tag manager and that's where my full course for beginners will help the video that you are watching right now explained around 10 maybe 15 of what a beginner should actually know about Google tag manager the rest 85 percent are explained in my course which is called Google tag manager masterclass for beginners I will post a link to it below the video if you found this video useful hit the Thumbs Up Button below the video that will help me understand what videos you like and what should I create in the future also if you want to learn more about Google tag manager or Google analytics 4 then consider subscribing to this channel my name is Julius this is analytics Mania and I'll see you in the next video thank you [Music]
Info
Channel: Analytics Mania - Google Analytics & Tag Manager
Views: 129,472
Rating: undefined out of 5
Keywords: google tag manager, google tag manager tutorial, google tag manager course, gtm tutorial, install google tag manager, google tag manager for beginners, google tag manager setup, google tag manager tutorial 2023, google tag, learn google tag manager, gtm for beginners, what is google tag manager, google tag manager guide, google tag manager explained, gtm tutorial for beginners, learn gtm, gtm course, google tag manager tutorial for beginners, google tag manager 2023
Id: DiAgCihHW58
Channel Id: undefined
Length: 61min 25sec (3685 seconds)
Published: Mon Sep 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.