With Google Analytics and Search Console, you can examine and analyze the data of your site or pages. With the data obtained from here, you can perform analyses and expand the strategy you offer to the businesses you provide consultancy to. From time to time, we can add an attention-grabbing button and direct users to product or service pages, and we may prefer to collect conversions by presenting a form with a pop-up, or the click data of the buttons can be requested with the request from your customer.

First, we will start with the basics, talk about the Google Tag Manager tool, and present the metrics that will be useful to you. In the last part of the content, we will perform an event assignment with a sample definition. Of course, important information is waiting for you in between. 

What is Google Tag Manager?

Google Tag Manager is a free tool from Google, just like Search Console and Analytics. Thanks to this tool, you can track whether visitor behavior is completed without having to intervene in the code blocks on your site or application. 

You are probably questioning how this process is done without requiring a software intervention. We can convey the working logic of GTM simply. The information from your site is sent to Analytics via Google Tag Manager. In other words, Google Tag Manager provides the bridge between your site and Analytics, where you send your site's data with the tracking code. Here, GTM shares the information it receives from your site with another data source. 

Additional Information: You can check if your site has a GTM code with Google's free Tag Assistant Chrome plugin. You can access the Tag Assistant Chrome extension here.

How to Install Google Tag Manager?

If you know how to set up Google Tag Manager, you can check out the next section, GTM's components. You can follow the steps below to quickly create a Google Tag Manager account.

Log in to Google's free product Tag Manager using your Google account and fill in the information completely by clicking the Create Account button.

In the Install Google Tag Manager section, you must add the first code block between the <head>...</head> tags and the second code block in the <body>...</body> code block from the source code.
After this process, you should check whether there is a GTM code on your site with the Tag Assistant Chrome plugin offered free of charge by Google. You can access the Tag Assistant Chrome plugin here.
If GTM is running smoothly, you can continue reading our content to have all other information.

Components of Google Tag Manager

Google Tag Manager has three main sections: tags, triggers and variables. In addition to these components, we will also talk about the data layer.

What is a Tag?

The tag allows you to take information from a specific section and create a snippet of code in the HTML or JavaScript part of your site. The tag sends information to GTM about what it needs to do.

For example, you can access how many people filled out the form on your product page on your site by creating a tag. You need to choose the correct tracking type of the tag you create.

What is Trigger?

Tags created in Google Tag Manager are triggered by actions such as views and clicks. The trigger contains the conditions when the created tag will be triggered or in which cases it will be blocked.

You must present the correct trigger type and the conditions under which the trigger will work. But how do you make sure that you are presenting this condition correctly? This information is available in the practical example at the end of the content.

What is Variable? 

When creating a trigger, variable information is included in the specified conditions. A variable is a placeholder for any value, that is, the part where it is positioned. It holds changing values such as the name of the product, id information, price value.

For example, you can see the screenshot of the click classes built-in variable below.

What is Data Layer?

A data layer is a JavaScript-based object used to transfer data from your site or application to Google Tag Manager. GTM uses the data layer to temporarily hold the data. I'd also like to point out that you'll get the best performance if you use it with a data layer. You can check out the Google source for creating a data layer.

If you don't want to struggle with source code and want to manage it yourself, you should know this information basically. Now we can move on to the implementation part, which is a bit more fun.

Event Assignment with GTM

I would like to measure the clicks on the All Tools button on the home page where our free SEO tools are located. In this way, we can easily access the CTR data and measure the performance of the button with the section of the button click data of the users coming to the home page. First, you should determine whether there is a predefined event on the relevant button. “Event tracking tracker” chrome plugin can be used for this.

First, when we log in to GTM, we need to run Google Tag Manager by clicking on the preview button in the upper right corner. Here, we made a connection to Google Tag Manager by including the information of the relevant page in the URL section.

As in the screenshot below, when I clicked on the “all vehicles” button, no tag was triggered. After the event assignment process with GTM, the named tag will be triggered.

On the page that opens, we will now have access to information about all clicks. Here, variables for each button, form or clicked part are presented. Thanks to these variables, definitions can be made under the specified conditions.

Thanks to the variables of the button above, we will create a trigger. For this we need to visit the “triggers” section on the left panel of GTM, click on the “new” button and give the trigger a name. Select the trigger type by clicking on the trigger configuration. Since I will be working with click data here, we click on click>all items.

In this way, we will determine the conditions of the trigger we will create to access the click data. We will use the variables created after the click operation I mentioned above when creating conditions. Each click data may have different variables or may present the same information. Here, the variables differ completely according to the approach of the software team when creating the relevant part.

Let's talk about some built-in variables you are likely to use here.

Page Path: Specifies the path part of the corresponding URL.

Page URL: It shows the address path, i.e. URL, of the relevant page.

Click Element: It accesses the gtm.element key in the dataLayer that temporarily holds the data. This key contains the HTML element of the auto-event action. That is, this variable references the corresponding element in the DOM at the time of the click.

Click Classes: It accesses the gtm.elementClasses key in the dataLayer that temporarily holds the data. The variable provides the string value of the “classes” property in the DOM at the time of the click.

Click ID: It accesses the gtm.elementId key in the dataLayer that temporarily holds the data. This variable provides the string value of the “id” property in the DOM at the time of the click.

Click Target: accesses the gtm.elementTarget key in the dataLayer. This key sets the condition specified in the Tag Manager.

Click URL: accesses the gtm.elementUrl key in the dataLayer. This key represents a value of the href or action attributes.

Click Text: accesses the gtm.elementText key in the dataLayer. This key presents the text attribute in the DOM.

You can also find information about built-in variables for Android containers here and the Google source for built-in variables for iOS containers here.

After this information, we can configure the triggers. Here, knowing the structure of your site will help you choose the variables that occur as a result of the click. Because the rules created as a result of the triggers to be specified here affect the entire site, more than one part should not be triggered with the same rule. If it is triggered, you cannot access the most accurate data.

I selected more than one variable that can be unique from the parts in the variables of the relevant button above and created a rule. Here, when creating the rules, there are conditions such as it starts with, ends with, is equal to, is not equal to, does not end with. Here, I often prefer the conditions equal to, begins with, and is not equal to. I would like to point out that the trigger will work when all of these conditions in the 3 different rules above are true.

Additional information: If you don't have a parser variable and can't create a condition in the trigger, you can ask the software team to create a unique variable for you.

You should save the trigger after making sure it contains the correct conditions. After this process, we will create a label and connect with Analytics. We will create a tag to connect the trigger we have created. For this, we need to visit the “tags” section on the left panel of GTM, click on the “new” button and give a name to the tag we will create. Click on the tag configuration and select your Analytics type.

You should add tracking parameters by specifying a tracking type for your tag. Since we are creating an event, we select the tracking type and connect the relevant account from the Google Analytics settings section by specifying the category, transaction and tag information.

After the event configuration, we need to connect the trigger we created to the existing tag. For this, I click on the trigger section and select the trigger I created. After this process, I save the tag.

After creating the trigger and tag, we should check the correctness of the actions from the Google Tag Manager in the preview section. As in the screenshot below, the tag was triggered when we clicked on the “all tools” button.

Don't worry if you think you have done everything right and the tag is not triggering. GTM offers you a small but effective solution. We can examine the error by clicking on the tag you created from the “tag not fired” section under the triggered tags. 

To show this section, I made the conditions of the tag I created faulty and clicked on the relevant tag as I mentioned above. In the section marked in red below, the conditions that affect the triggering of the tag, that is, the conditions that received an error, are specified. In this way, GTM provides us with information about the error that we cannot access as a result of our checks. With this feature, we can edit our conditions in the trigger and ensure that the event runs smoothly.

If your tag is triggering and there are no issues, you should make this process live. To do this, just click the “submit” button in the upper right corner and add the version name and version description. In a short time, the tag and triggers will go live and data will be sent to Analytics. You can access this data in the “behavior>events>most popular events” section in Analytics and click data after event assignment. In order to access the click data, you must make sure that the date range is selected correctly. To get meaningful data, you can compare the number of sessions of the page where the button is located with the click data of the button in the relevant date range.

In summary,

With Google Tag Manager, you can monitor visitor movements and analyze user behavior by minimizing the software intervention process. In this way, you can measure the function and contribution of the relevant section.

By using the components in the GTM panel effectively, you can send the data to the next page through the data layer, and definitions can be made using JavaScript functions.

By using GTM and Analytics tools together, you can track clicks by defining events from GTM, and you can actively follow this process with the funnel setup through Analytics. At the same time, you can access the information on which channel the click data falls to the relevant section with the Google Analytics tool.

In our Google Tag Manager content, where there is a lot of information and applications, I wanted to create this article to give you, our valuable readers, a basic awareness and to explain GTM from the perspective of an SEO expert. I hope it was useful, if you have anything to add or ask, you can send it in the comments section.

See you in another article :)

Resources:

https://marketingplatform.google.com/about/tag-manager/

https://marketingplatform.google.com/about/tag-manager/benefits/

https://support.google.com/tagmanager/answer/7182738?hl=en&ref_topic=7182737

https://www.simoahava.com/analytics/variable-guide-google-tag-manager/