Skip to main content

Google Tag Manager - How to track events on your site


In many cases, however, tracking user behaviors on your pages is important. For example, click the "add to Cart" button, submit a form, or view a video. These behaviors are known as "events," so today, we will show you how to send them to Google Analytics via Google Tag Manager. The Battle Plan Let's make a battle plan as usual so that we all know what we are doing. We will begin by stating that we will. Compile a listWe want to track. We will, second. Set up event triggers. You can track every event on your website with a tool called CSS Element Selectors. We will also be distributing the information. Set up tags send data to Google Analytics for each event. We will, finally. Use the "preview" feature in Google Tag Manager to ensure that all events are correctly tracked. We recommend Google Tag Manager to track events for the following reasons: This is the approach that does not require you to add any code to your website. Implementation will be much easier if there isn't a technical person in your team. Google is always changing its tracking system. They are soon to release gtag.js, their new tracking code library. Google Tag Manager is a great way to avoid having to go back into your codebase and change the tracking mechanism each time there is an update. Google Tag ManagerThis interface is easier to use to see which events are being followed; if you have many events to track on your website, this interface will help you keep organized.

Step 1: Create a list

First, identify the events you want to track. I was a big fan of the "track all" approach. This advocates the tracking of every event that occurs on your website. This approach has the advantage of allowing you to see the entire user experience on your site. Being a data scientist, I love the idea of all the data. This approach has a drawback: It is easy to become overwhelmed by the volume of data and overestimate the business value of spending time analyzing every element of your page. This approach is not recommended for small to medium-sized businesses. Larger companies should still consider investing in sophisticated tools for behavior tracking, such as Hotjar (for event mapping) or Heap Analytics (for tracking event funnels) rather than using Google Analytics. Recently, I have become a big fan of the "macro-and-micro conversion" approach. This advocates only tracking macro and microscopic conversion events on your site. This approach recognizes the danger of analyzing every website event and teaches analysts to only record those events that are important to your business. These events can be macro conversion events. These are the steps your customers must go through in order to make a purchase or to submit a lead form. These events could also be called micro-conversion events, which indicate greater audience engagement. These could include clicking buttons to sign up for your newsletter or browsing product information on the website. Based on the above description, compile a list of micro-and macro-conversion events that you can use for your website. Next, we'll be ready for the next step: actually setting up event tracking.

Step 2: Setting up event triggers

Let's begin by briefly recapping what we talked about last week regarding triggers. Google Tag Manager automatically tracks page visits and events on your website by default. It doesn't keep any data unless you ask it to. You can use triggers to tell GTM to track specific events or page views you wish to send to Google Analytics and other services. We need to inform Google Tag Manager that the events we have compiled in the previous steps will be sent to Google Analytics. We will use a CSS element selector to do this. A brief primer on how to choose events It is important to conceptually understand how buttons on your website are coded and how we will choose these elements to identify the events you wish to track. All elements on your website are coded using HTML tags following the structure shown below. An HTML tag contains several key components. The tag NameIndicate the function of the tag in the context of your website. In this example, "h1" refers to "the first header." Attribute name you can also specify additional information about the header, such as its description. Class this is used to group tags with similar attributes. This is used as the unique identifier for tags Styles. The affected ContentThis is the text that will appear on the website in a button or a paragraph. A CSS element selector, which is a search language that allows you to identify specific HTML tags on your site using the components of the tag, can be used to help you understand these elements. The following query, "h1.primary", can be used to select the HTML tag shown in the graphic. The link below will provide more information about the syntax and use of CSS selectors. Enable the Element Selector in Google Tag Manager We have now conceptually understood the process of selecting events. Let's get down to business. Google Tag Manager lets you identify events on your website using the various attributes of those events (they call them "variables"). Google Tag Manager allows you to view a complete list of its built-in variables by clicking the "variable->config" button. Google Tag Manager provides a comprehensive list of variables that can be used to identify events. This tutorial will be about clicking, which is one of the most fundamental events. We will use the "Click Element" variable to accomplish this. It can be enabled on the screen below by clicking the box next to "Click Element." You can also enable other boxes within the Clicks category for more options during event selection. Identify the CSS selector for your events. We now need to identify the unique CSS selector for each event. To do that, we will enlist the help of Google Chrome Web Development Tool, a series of tools that you automatically have access to if you have Google Chrome. As an example, we will use the Google Merchandise Store. When a user clicks the add-to-cart button for a product on Google Merchandise Store, the add-to-cart action takes place on the page and not on a separate page. This click must be recorded as a micro-conversion. When on this specific screen (you can follow along by going to this link), right-click and select "inspect" on the dropdown menu. The right-hand side panel of the console will appear in the screenshot below. The screenshot explains that you need to first click on the element selection icon in the upper left corner of your console. Next, hover over the element you are interested in using your cursor. Click on it to reveal your CSS identifier. Finally, use the console query document.querySelectorAll to make sure there is only one result returning, so the CSS selector is unique (this will usually be the case). You now have your CSS selector. P.S. P.S. If that doesn't work, identify the overlapping element in your CSS selector and exclude it from Google Tag Manager Triggering (we'll show you how). Setup the Trigger We are now ready to trigger the alarm. Select "New" from the "Triggers" section in Google Tag Manager. Click on the Trigger Configuration Box and choose Click >> All Elements. Select "Some Clicks" in the setup screen. This means that you want to only track clicks occurring on your website. Next, click Click Element, Matches HTML Selector, and enter the unique CSS selector that you have identified in the previous step. You should make sure that your CSS selector is unique even if you extend the parameters. It should look something like the picture below once everything is set up. Finally, save all configurations. We are now ready to assign the tag!

Step 3: Set up the tag

Good news! The most difficult part of this process has been completed. It's now all non-technical smooth sailing! This step will allow us to set up a tag that sends the event trigger through Google Analytics. As I explained in our last week's post, navigate to the "Tag" section on Google Tag Manager by using the right navigation bar. Click on the red "New" button at the top of your screen. Configure the Tag You can configure the tag using the exact same Google Analytics settings that you used last week, but this time select "Events." You will have more options to tell Google Analytics about the event by selecting it. This is how I recommend organizing events. However, you can create your own structure. Category: This is the general category of the event. It can be a check-out event, engagement event, or something else. Take action. This is the action that took place during this event. For example, click_add_to_cart or click_video. Label: Here, you can add additional information about your events, such as the product clicked or the video being watched. I value the following: If you're using sophisticated micro-conversion values assignment in your analytics pipeline, you can assign a value for this event. If you don't have a sophisticated micro-conversion value assignment, you can assign a value to this event. Otherwise, I recommend that you leave it blank. Once you have completed all information, click Save. Let's now set up the Trigger. The Trigger can be connected to the Connect Tag. This step is easy. This step is easy. Save, and your tags will be officially configured.

Step 4: Debugging using the Preview Feature in Google Tag Manager

Technically, you need to make sure that all your events are correctly configured on Google Analytics. This is a common problem with every technology. This is why you have to be prepared.ToolsGoogle Tag Manager's preview function is available to assist you in determining if the event tracking you have just set up is functioning. Once you have set up all the events that you want to track, click the "Preview" button in the upper right corner to go into preview mode. Open the Google Tag Manager tab and then open a new tab to your website. The bottom of your screen will have a debugger section that looks similar to the one below. This section lists all actions you have taken to your website. The right side shows you which tag fired in each action. Go back to the event list and click on each one to verify that the tag is working correctly. Double-check everything to ensure it's working correctly. Once everything is properly configured, return to Google Tag Manager and submit all changes for event tracking. Congratulations, you are done!

Comments

Post a Comment

Popular posts from this blog

Which is the best SEO tool?

Here is my list of free SEO tools that will help you to be an SEO pro. SEO is getting more tough with every passing day. Therefore it is not an easy task to do SEO these days. For this reason, there are some free SEO tools that will help you to minimize your SEO efforts. Without these tools, it is nearly impossible to do SEO. Today I am going to share with you the list of the top 20 free SEO tools that will help you to make your SEO more effective. You may already know some of the tools that I am going to mention here. But on the other hand, you will definitely don’t know about some of the excellent tools that I am going to explain here. 1.Google Page Speed Insights It is one of the best free SEO tools launched by Google. Now it is providing the performance data based on the Lighthouse analysis It basically helps you to get a performance report of your website on mobile and desktop devices. Besides, it gives the overall score of your website based on the speed of your site. It provides...

Tips to start a business at Search Engine Optimization (SEO)

Do you want to start an SEO business? It is one of the lucrative businesses. Is not it? If you want to start an SEO business, you have to adopt some techniques which will help you start your business successfully. What you should you do? Learning, learning, and learning. Join SEO Online Course or Learn Digital Marketing From Best Digital Marketing Institute The process you should follow for an SEO business. You should build two websites. One is to rank and another is to promote yourself. Website 1: You should target the keywords to rank, if you can rank, you will get the confidence to work with others keywords. First of all, you should start the low search volume keywords so that you can rank easily. The low search volume keywords are normally with low competition. After publishing the content, you can start the process of practically backlinks creation. A website's ranks normally depend on different types of backlinks. If you can learn the process of versatile backlinks creation,...

How do I start a career in digital marketing?

As a fresher, you would need to keep an eye on every possible detail about this field from all the sources as possible. You can even take up a good online course, but then I wouldn’t suggest directly joining a course. You can start reading stuff from the free online resources. This will surely help you get started on the subject. Also, as a start, you can try YouTube, as a good source of free information. Now the only problem with these resources is that they are all scattered and you might have to struggle hard with finding the streamlined information. And that brings me to the topic of learning the subject from a professional. Joining a good course Now, joining a good course has literally become the need of the hour for the following things: A complete course package that consists of a holistic curriculum Getting to learn from the best industry experts Live projects to work on and gain some hands-on experience Complete professional guidance and assistance when it comes to getting con...