An easy way to track all clicks on your website in Google Analytics

Stefan Kasbauer
4 min readOct 30, 2020

With just a few steps you will never miss a click on your website again.

Photo by Myriam Jessier on Unsplash

I don’t think I have to tell you the importance of Website Analytics. And I don’t have to tell you how Google Analytics works.

So let’s get to the point straight away.

Has the following situation ever happened to you?

You want to analyze the clicks on a certain button on your website. You open up Events in Google Analytics. But you can’t find an event that measures clicks on this button. You will never know how many user have clicked on this button.

I’m gonna show you how this scenario will never ever happen again to you. And all you have to do are just some few clicks.

Requirements

In order to be able to track all clicks on your website you’ll need:

  • A Website (haha!)
  • Google Analytics (of course)
  • Google Tag Manager (that’s where the magic happens) with a working tag for GA pageviews

Implementation

Let’s get into this.

I assume you do have a working tag for GA pageviews in your GTM container. So you already know basic stuff and how tracking via GTM works. If not you can find some very good tutorials on how to do that. Please read them and if your tag for GA pageviews is working you can come back here :).

Idea

The idea is to create only one trigger and one tag for all clicks and use variables to send detailled information about the click to Google Analytics.

And this is how we can do that

  1. Create a trigger that fires on all clicks
  2. Create a GA tag that is triggered by this trigger
  3. Use variables to send detailled information about the specific action

1. Create a trigger that fires on all events

Create a new trigger of the trigger type Click — All elements and choose All Clicks.

Create new trigger

Save. That’s it.

2. Create a GA tag that is triggered by this trigger

  • Create a new tag of the tag type Google Analytics: Universal Analytics
  • Select Track Type Event
  • Select your already created GA Tracking ID Variable (the one you need for your pageview tag)
  • Scroll down to the section Triggering and choose the trigger we’ve created in Step 1
Create new tag

3. Use variables to send detailled information about the specific action

You will only need this one tag to send information about all clicks to Google Analytics. To send the correct information you have to use some variables that can identify specific clicks.

Usually the variables Page Path and Click Text are perfectly suited for that.

Page Path allows you to know the page on which the click happened.

With Click Text you know on which text and therefore which element the user clicked.

If those variables don’t work for you for some reason you have to find others that allow you to identify specific clicks. I’m pretty sure there are some for your website :).

In order to send the data to Google Analytics you have to insert those variables in the Tag in the fields Category, Action and Label.

In the screenshot you can see the way I usually enter the variables. Notice that the Action Click is not a variable but a self-defined action. That way I can filter all clicks in Google Analytics later on.

Enter Variables to send information to Google Analytics

That’s it!

After you publish your Google Tag Manager container you can track all clicks on your website. Congratulations!

Click Report

Now if you want to know how many times a certain button was clicked you head to Events in Google Anayltics again.

Under Event Action you can now see the count of all clicks on your website.

Analyzing all clicks on your website

When you click on Click you can see the pages on which the clicks occured under Event Label and the text on which the user clicked under Event Category. That way you can identify each click that happened on your website.

Additional tracking

You can track even more on your website than just clicks with the same three steps.

For example:

  • PDF downloads by using a trigger that fires on clicks where the Click URL contains “pdf
  • Internal links by using a trigger that fires on link clicks where the Click URL contains your domain (and external links where it doesn’t contain your domain)
  • (when you use the same html class for all your buttons) All button clicks by using a trigger that fires on clicks where the Click Class contains “button” (or whatever class you’re using)

And so on…

I hope you’ve liked my post and you can use this knowledge to track all clicks on your website. As this is my first post ever, I’m looking forward to some feedback :).

If you have any questions, ask me :).

--

--