Buttons tracking at Google Tag Manager 2.0

Each website has several different buttons, which clicks would be useful to track at Universal Analytics.
For example:

  • Social plugins buttons;
  • “Add to cart” button;
  • Change language buttons;
  • “Send” buttons at website forms
  • etc.

At this short article I described, how to set up tracking for buttons with help of Google Tag Manager and Universal Analytics.

Buttons clicks tracking

For example, we want to track click at one of the social media buttons at this blog:
Example of social media button

Most convenient way for buttons clicks tracking at Universal Analytics – is Event Tracking.
Each Universal Analytics Event has 4 main paramaters:

  • Category*;
  • Action*;
  • Label;
  • Value(integer).

*Category and Action are required paramaters.

Let’s say we want to track click on Facebook button.
In this case we will use event with following parameters:
Category: Buttons
Action: click
Label: Facebook
Value: 1

Usually I make settings at Google Tag Manager interface for variables at first(if necessary), then – for triggers, and finally – for tags.

1.Set up variables

At GTM interface left menu click at “Variables” and after that find “Clicks”. Mark all or several variables. Only after variable was activated there, we can use it at our tags or triggers.

Variables configuration at Google Tag Manager

2. Set up triggers

Let’s go to “Triggers” at left menu and click at big red “New” button.

2.1. Choose your event – choose “click” here.

2.2. Add filters – choose “Some clicks”.
! There we should define, which element click will fire our trigger.

At my website Facebook button – is HTML-element <a>, which attribute “class”
equals “icon-facebook”:
Example of HTML markup
So, we can use filter:
[ Click classes ] [ contains ] [ icon-facebook ]*
If you can’t find “Click classes” variable(or other for your case), go to p.1 and check, is this variable active.

2.3. Configure your trigger
At “Trigger name” field give name to your trigger. I usually give them understandable names, like “T – Buttons – Facebook click”.
As “Trigger type” choose “Click” and click at “Create Trigger” button.

After settings my trigger configuration looks like:
Example of trigger config at Google Tag Manager

3. Set up tag

Go to “Tags” at left menu and click “New” buttons.

3.1. Choose your tag
Just click at “Google Analytics” image.

3.2. Choose a tag type
Choose “Universal Analytics” and click “Continue”.

3.3. What triggers this tag to fire?

  • Choose “Click”
  • At the popup window choose trigger, which was created at p.2.
  • Click “Continue”

3.4. Configure your tag
Tag name: for example, “UA – Buttons – Facebook click – Event”.
Tracking ID: this means Universal Analytics Tracking ID(UA-XXXXXXXX-X), you can find it at Google Analytics interface: “Admin -> Property -> Property settings”.
Enable Display Advertising Features: activate(optionally).

All following settings are made for certain Event.
Track Type: Event
Category: Buttons
Action: clicked
Label: Facebook
Value: 1

Non-interaction hit: False.
After I finished all settings my tag configuration looks this:
Example of tag config at Google Tag Manager
Check your settings again and click at “Save tag”.

4. Publish container

Click at “Overview” at left menu, click “Publish” and at pop-up window click at “Publish now”.

5. Testing results

If all settings was made correctly, after click on our button Universal Analytics event will be sent.

We can check this at “Real-Time Reporting -> Events“ at Google Analytics.
After I clicked at my Facebook button I saw data about Event at my reports:
Universal Analytics events data example


If you have Google Tag Manager installed at your website, then you can track buttons clicks at your website as described at this article.
After several days(when data will be collected at Universal Analytics) you can make a conclusions about how many users clicked at buttons(“Unique events”) and how often they do that(“Total events”).

Digital analytics consultant.

Want to improve your website performance?
Contact me!


  1. After banging my head against a wall for several hours reading Google’s documentation on GTM v2, I stumbled across this post. I’m starting to make a little bit of progress with this GTM thing now! Thanks!!

    1. Jimmy, thank you for feedback,
      I’m glad, that my post was helpful for you!

  2. This was very informative and you seem to know what you do inside out. Are you able to contact me for a piece of work please? Thanks

Comments are closed.