Button Click Tracking in Google Analytics Using GTM

Team TypeStack
Team TypeStack ...
Nov 30, 2022  . 7 min read
shareshareshare
share
How to track button clicks in Google Analytics 4 using Google Tag Manager - TypeStack
How to track button clicks in Google Analytics 4 using Google Tag Manager - TypeStack
Table of Content

One of the most popular actions in Google Analytics 4 is click tracking. To better understand your user, you have to see their actions.

Read further to know more about Google Analytics button click tracking.

There are two types of events mentioned in this article. The first event is automatic tracking events and the next is customizing the Google Analytics click events tracking.

Introduction to click tracking

To better understand your visitors, what do you think is the next popular tracking event after page views and scrolling? It's clicking.

Yes. You have to track clicks and analyze this data with Google Analytics button click tracking using GTM or Google Tag Manager.

There are 4 most popular use cases of click tracking-

Outbound link click - It means when the visitor clicks on a link, it directs the visitor to a new page i.e. third-party website.

File downloads - Those links that contain a file. These file extensions can be pdf, doc, mp4, and many more.

Button click - Those clicks that tell a specific action, for example, “add to cart” button.

Contact link - As the name suggests, these links contain the email address, contact number, or address.

What is automatic click tracking?

Google Analytics 4 is popular among marketers for Enhanced Measurement, as it gives them the option to include as many events as they want in their report.

You will find the “Enhanced Measurement” window under the “Admin” section, then select “Data streams”, and click the “Web” tab.

All the following features are by default in action:

  • Site search
  • Video engagement
  • Outbound link click
  • Page view
  • Scroll
  • File download

You can also turn off the automatic route and customize the settings by clicking the toggle button.

Let’s go over two of the above events in detail-

Clicks

Outbound link clicks are associated with clicks. In addition to the event other parameters, for example, link_id, link_url, link_classes, and link_domain are also sent.

If you have opted for more than one domain, then you can instruct Google Analytics to not include the other domain in third-party resources. Choose the event stream, then go to “tagging settings”, find the “configure your domains” option and insert your domain business.

You can write more than one domain also, all the domains written here will not trigger the outbound link click.

File download

Downloading a specific file in any format comes under this event tracking. File extensions include .mov, .midi, .csv, .exe, .pdf, .pptx, .pps, .rtf, .wav, .mp3, .mp4, .zip, etc. At the moment GA4 interface does not give the option of updating the file extension list.

After selecting the tracking event, save the settings with Enhanced Measurement enabled.

How to track custom clicks?

Let's take an example of tracking clicks in the menu bar i.e. Home, Catalog, Blog, Subscribe, & Contact. First, create a trigger that separates the menu link click from other links on the web page.

Open GTM Preview mode and simultaneously click on the menu. Click the first link and see if the “Link click” option appears in the preview window. If it shows, then ok. But if it doesn’t show, then follow the steps to create a link click trigger-

  • Open GTM, then “Triggers”, find “New”, and click “Just Links”.
  • Then choose the option “All link clicks”
  • Save the settings
  • Then select “Variables”, and find “Configure” under the “Built-in variables” head.
  • Blue tick all the click variables
  • Now refresh the preview mode

Now your tool is ready to track menu bar links. Once again open the website and click the menu links. Simultaneously open the preview mode and you will find the “Link click” option.

Why do you need to register custom definitions?

If you want custom parameters to appear in the free form or funnel exploration, then you have to register custom parameters in Google Analytics.

Under GA4, find “Configure”, then select “custom definitions”. A window will appear displaying “custom dimensions” & “custom metrics”. On the right side select “create custom dimensions”, then follow the steps-

  • First, you have to enter the dimension name (write whatever you want).
  • Either choose a user or event under the Scope heading. Here user means to track all events of the same user or one specific event.
  • In the “event parameter” paste the name as copied from the GTM tag. Don’t change the name. Now save the settings.

You have to wait for 24 hours before custom parameters start showing in GA4 reports.

How to test your click tracking?

Before finally doing the website click tracking the events, and test them in the Debug view. You will find the Debug View under the “Configure” head. For your information, “Debug View” and “GTM Preview and Debug mode” are both different.

There are many ways to enable debug mode-

  • Enable the preview mode in GTM in advance.
  • Turn on the GA debugger chrome extension
  • In addition to events send debug_mode parameter also

After enabling the debug mode, you will see the data coming in. Do some random checking of the parameters and see the debugging of your events.

After making sure that all data is correctly inserted and click events are performing properly, you can publish by clicking “Submit”.

How to track button clicks?

There are two aspects of buttons, one is simple links that look like a button. Another one is considered asother elements, for example, an HTML element i.e. <button>.

Follow the steps mentioned in this article for Google Analytics button click tracking.

Which clicks are marked as conversions?

Some clicks might turn your visitor into your customer. Those clicks will be more important to track. Therefore, tag those clicks as conversions in Google Analytics 4. Previously conversions were called goals.

Frequently Asked Questions

Is it possible in Google Analytics to do button click tracking also?

Yes, it is possible. There is an additional built-in feature for tracking events of outbound link clicks and file download links.

Can GTM track click links also?

Turn on the “Just Links” trigger and fulfill other conditions. Now Google tag manager is ready to track click links also.

Is it possible to track button clicks also?

Under the GTM, enable the “All elements click” option and add other conditions also. Now Google Tag Manager can track button clicks also.

Where is to find the click data in the GA4 report?

Open the “Exploration or Reports”, then “Engagement”, and at last select “Events”. Before following these steps register click data as custom dimensions.

Final words

Now you don’t have to stick to the automatic click tracking, read patiently to know how to track clicks on a link in Google Analytics as per your requirement. In short the Google Analytics button click tracking is-

  • If your tracking is limited to outbound link clicks and file downloads, then make sure to enable the Enhanced Measurement feature of GA4
  • If you want to track more clicks for better research and analysis, then create a trigger and link it with Google Analytics 4 event tag.
  • Apart from link clicks, if you want to track buttons also, then use the element clicks trigger.

Now you are equipped with a free click tracking guide to enable you to track every action of your visitor.

success