GOOGLE TAG MANAGER: How To Set Up Event Tracking in Less Than 1 Hour

Once you start to get serious into the digital marketing realm as a company or as a professional in the field, you must do one thing to fine tune your strategy and master conversions: Track Events. Every user interaction must be tracked so you can understand visitors’ patterns. This gives you enough data to see which spots of your website needs some improvement and more attention.

That’s how we build solid marketing strategies.
We listen to our users’ interactions.

And how do you do that?
Answer: Use Google Tag Manager (GTM) to track your website events.

Ok. Now, this article will go through these points below:

  • Tracking outbound links
  • Tracking clicks on buttons
  • Tracking PDF views

Here we go!

If you are not a developer or you are not familiar with programming that much, then you must pay attention in what I’m about to say here because, in this first section, I’ll point out an important thing that can cause true chaos and make all your marketing efforts go down the toilet.

It will take 30 seconds to make you understand. Starting now.
Ok. When TAGGING something, you are using code. Hardcore code. That’s how you create the necessary structure to GTM, so it can make itself useful and help you see who is doing what and where. The structure is the code of your website, which Google depends on to function properly.

And that structure has a name: HTML (HyperText Markup Language).
This is one of the languages that Google is fluent. You speak English, Google’s tools speak HTML. Now, what I’m about to say is just what’s necessary to alert you so GTM can work without worries on your site. And if you have no contact with HTML before, and in case you REALLY want to go deep and learn it, then you can go to or you can watch this HTML tutorial for beginners video.

Moving on…
There are individual elements on a page. Elements such as buttons, fields or forms can have various attributes, which are in the form of key=”value” pairs. The “key” is the property name which is built in on HTML and can’t be changed. The “value” after the “=” is the value of the field, which is where people insert data.

You can identify what attributes a specific button has by locating the HTML when you right click and view page source. Just don’t freak out after seeing too much code.

Ok.And since you’re still here, I’m going to explain which built-in variables are used in Google Tag Manager. The ones you need to know about at least. Well, the list is this:

  • CLICK CLASSES – Refers to the active classes on the clicked element. The HTML code that use classes correctly would have to use the part in bold, like this: <button class=”peterson-is-awesome”> Test </button>
  • CLICK ID – It’s simple, this refers to the ID attribute — which must be unique — of the clicked element. Every ID must NOT repeat in the whole code of a website. Remember that. And here’s the example of what it is like in HTML: <button id=”landing-page-3-button”> Test </button>
  • CLICK URL – This is about links. It refers to the href attribute of the clicked element which is always inside the href. The HTML code snippet about this: <a href=””> Google </a>
  • CLICK TEXT – Same deal regarding the code of a link, but the text is the main character now. Meet the code: <a href=””> Google </a>

Got it? This is what you must know to understand the GTM tracking mechanics. With this, you can create a better strategy around these resources and build a more specific marketing approach. Also, you can already see why the code of your website can destroy all your tracking structure if one comma is altered.


That’s the warning. Pay attention to your coding or else you may lose a tracking point here or there. Or maybe everything. So stay friends with all the developers of your website and send then candy every once in a while or else they might change a class name or a button ID and bring hell upon your marketing campaigns.

Well, enough bad news.
Now I’m going step-by-step with you to help you understand each point, so you don’t get confused in the process. Let’s begin.

Is highly recommended that you test your changes every single time before publishing them. Put that in mind and stick to it. Make it your “modus-operandi” just so you can be sure that your efforts toke place in GTM correctly. And in order to do that, just go to the top right dropdown and click on it, and this menu below will appear to you:


You are now in preview/debug mode.
Now just go to the website you are tracking and it will show a frame on the footer of your website WHILE you are on the same Google Chrome instance (window) and with GTM debug mode activated.

Once you enter debug/preview mode and go to your website, you should see something like this below:


There you can see which events were triggered, which were not, event variables, among other things. In my case, I already clicked on the menu and that’s why the GTM.LinkClick tag is standing there on the right side of Pageviews. And I created 2 events as well: one for pageviews and one for clicks. Both were triggered as you can see on the image above.

In case your event was not triggered, just go to the tag card and click on it. At the end of the new screen that will appear to you, search for the firing event conditions to see if each one was met. That way you can catch any errors.

Like this my friend:


Be aware and check false flags as well too. Analyze your tags and check if they are triggering with the wrong conditions because sometimes we tend to forget one or two conditions when setting more complex rules.

Ok, we now know how to debug everything we do.
Let’s go to the next part.

The main reason behind tracking outbound links is to get additional data about from where people are leaving your website and why. And understand this: by knowing this metric, you won’t get 100% bad news! Why? Because there are “exit points” which will show you that the visitor left because he decided to click on your Youtube Channel, for instance. Which means a deeper interest on your brand and therefore, good news.

Ok, in order to make sure things will work out, go to the variables section and check if you are viewing this:


Next, we need to create a trigger with the conditions below:


And then we must set up a Universal Analytics Event Tag. Choose that trigger you set up to control when your tag will fire and also, pick the ‘{{Click URL}}’ variable as your event label. That way you can see the links differently. Got it? Good! Your tag should be something like this below if you did things as I said:


Now is possible to know from which parts of your website people are leaving.
And also, if it is good news or bad news 🙂

If you have the necessity of knowing which PDFs (Guides, Ebooks etc) are becoming famous and which ones are not gaining too much attention, it is possible to track your PDF downloads to find out these metrics. Having the information about which PDF documents are popular and which ones are not, can tell you a lot about your visitors. A lot.

So the first thing is to create a new trigger involving the PDF extension:


And then we go to the tag….


This will enable you to track PDF downloads. Remember that you can do this to all file types, just change the extension when you create the trigger.

Now let’s FINISH THIS with another very common necessity!

Now we finally got to the Big Boss. Buttons. If you work a lot with landing pages, this is one of the few tracking events you should want to incorporate in your weekly reports. Since landing pages use A/B testing a lot — especially with buttons — this can come to hand to help you understand what to optimize.

Colors, sizes, fonts, positioning…
EVERYTHING matters for conversions.
And now we can track all of our implemented ideas to see if they are working out.

So first, we must create a trigger event where you use the Click ID variable. That’s how we start. And don’t forget that you must replace ‘example’ with the ID of YOUR button that is on your website.


And now we just set up the new tag and voila!


Understand that tracking buttons is NOT the same as tracking forms. Why? Because tracking forms and newsletter forms involves ACTUAL CONVERSION! This means that the person who clicked on “submit”, didn’t left any field on the form stop him from submitting the data. A click on a button can be on an empty form which won’t convert.

That’s the difference.

Take care.


This is not for everyone. If you truly want to improve your business and you REALLY care about delivering a high-quality experience to your customers, instead of just making money, then click the button below. Otherwise, I'll not be able to help your business. You must have a true Entrepreneurial Mindset. Make your choice.



Leave Your Comment Here

CommentLuv badge