Track Button Clicks in Google Tag Manager

Google Tag Manager v2 allows website owners to easily track button clicks by setting up a tag to pull data in Google Analytics. You can easily complete this in less than 10 minutes, 5 if you are fast 🙂 Follow the instruction below. To learn Google Tage Manager quickly, check out Google Tag Manager for Beginners Plus.

To track button clicks in GTM follow the instructions below:

The process is split into 3 parts:

  1. Build a Click Trigger
  2. Click Trigger Configuration
  3.  Linking to the Google Analytics Tag

New Trigger

>
Build the Generic Click Trigger:

In order for us to track button clicks we must trigger this event so that this data can be passed to Google Analytics.  We know that we want to track button clicks but we don’t know the the data markup that defines that each specific button click.

90% OFF Google Tag Manager Course No Code Needed

 

So the first step is to build a generic click trigger so that an event can be created in GTM. You can build a generic click trigger now and define it later. Here is how:

  1. Open GTM
  2.  Click Trigger
  3. Create a new Trigger
  4. Choose Click for the event
  5. Choose All Elements  when configuring
  6. For Fire On, choose All Clicks
  7.  Create Trigger

button trigger generic

Identify the HTML markup of the button click by using the GTM preview to view the variables that define your click. You will need to refresh the  page and then click the button. In the event summary find the gtmclick event Reveal it’s variables by clicking the variable tab.

Click Variable

Defining the trigger

We can use the information to transform the generic click trigger into a specific trigger. For example the click class associated with the trigger is “search-button”. Use this information to redefine the click trigger.

  1. Choose the Generic  Click Trigger.
  2. Rename it to a specific name
  3.  Change to Fire on Some Clicks.
  4. Choose Click Classes and within containing add  “the button name.  In this case, I’m using the name “search_button”.

Attaching the Trigger to Google Analytics tag

  1. Open GTM, create a tag
  2. Choose the Google Analytics Template
  3. For tag type, choose Universal
  4. Click Configure Tag and add your Google analytics tracking ID
  5.  For the Track Type, Choose Event
  6.  Name The Category,  Action and Label.
  7. For the Value, you will need to define this for my purposes I chose page path because I would like know the page where the click occurred
  8.  For the Fire On rule, choose the More option and choose your defined click trigger.
  9. Create Tag

Event GTM

Lastly open your Google Tag Manager preview mode and test the tag. After click the button, you will see that the tag is firing currently.

Buttton Click Tag Fired in Google Tag Manager

GTM Button Click Fired

For a quality check you to view whether this information is being pulled into the Google Analytics events. We check the real time events to see if the data can be tracked in analytics.

 

How to Track Button Clicks in Real Time using Google Analytics

In order to see whether the button tracking is working correctly, you will need to check your analytics account to ensure that the data has been based correctly via the tag. To this you can look into the event section to discover if the button click can be found in the real time data events.

  1. Real Time –> Events

button_click_Google_Tag_manager

Video Tutorial for Tracking Clicks

Google Tag Manager Resources