Tracking events like button clicks, link clicks, call widget clicks, and form submissions is an advanced measurement technique. It requires some basic understanding of how Google Analytics and other measurement tools work.
A button click – or for that matter any click – is called an event in Google Analytics. We will use that term throughout the blog post. We will use buttons as examples, but the same methodology applies to specific link clicks or clickable actions.
How to track button clicks in Google Analytics?
In short, you need to create an event goal in Google Analytics with pre-defined parameters in Google Tag Manager.
- Identify the unique identifier for the button click
- Create an event in Google Tag Manager
- Create an event goal in Google Analytics
Let’s jump into the step-by-step tutorial.
8 Steps to track button clicks in Google Analytics with Google Tag Manager
1) Enable all “click” variables in Google Tag Manager
In your GTM workspace, navigate to Variables and click “Configure”. Next, scroll down to the “clicks” and enable all clicks variables. The selected variable will appear immediately in the list of built-in variables.
This step is required so that Google Tag Manager can track the variables to identify the unique button click parameters for each button click you want to track.
2) Configure Click Elements as Triggers in Google Tag Manager
Secondly, we need to configure click elements and create a trigger. Navigate to “Triggers” in your GTM workspace -> add new trigger -> Click -> All Elements -> All clicks (for now)
We need to fire all clicks for now in order to identify the unique variables for the button you would like to track in Google Analytics. Later, we will come back and modify this click trigger to only fire for the selected button.
3) Identify a unique variable for the button click
Preview your triggers in Google Tag Manager:
Enter your domain to open the debugger. Your website will load in a new tab and in the right corner you will see the debugger. Please note, if you use the Tag Assistant Legacy (by Google) Chrome extension, you may have to reload the extension for the debugger to connect successfully.
In the tab of the domain, you can now locate your button and click it. For illustration, I will use the search button on Back2MarketingSchool:
When I click the button, you will see in the debugger tab that all actions in the backend have been monitored.
You can find all previously enabled click elements in the variable section of the click.
The goal is to identify a unique parameter that lets you track that button click. In an ideal world, you would have a unique click ID but in most cases, the reality looks a little different. It now comes down to knowing your website. For me, the Click Classes with the string “search-submit” is specific enough to clearly assign my goal to this variable.
4) Adjust the trigger in Google Tag Manager
In Google Tag Manager Workspace -> Triggers -> Your Trigger (ex. Button Click”) -> Change trigger to “Some Clicks” and select a unique identifier or combination of unique identifiers.
5) Create a new event tag in Google Tag Manager
Workspace -> Tag -> New -> Tag Type = Google Analytics Universal Analytics -> Track type = Event:
Now you need to add an event category, action, label, and value (optional). It doesn’t matter what values you assign to each field, as long as it makes sense in your Google Analytics reporting naming convention.
Choose the trigger you’ve modified in the previous step. Click Save.
6) Submit and publish the Google Tag Manager workspace changes
Submit and publish the changes to activate the tag and trigger on your website. (Submit button in the main navigation)
7) Create button click event in Google Analytics
We’ve created the tag and need to connect the button click tracking with Google Analytics. In GA, head to the admin section -> Goals -> Create a new goal:
Name: choose a meaningful name
Goal Type: Event
Event conditions: the event conditions need to be the same as defined in the Google Tag Manager Tag. (see screenshot)
8) Test the button click tracking in Google Analytics
You can test it in two different ways – both versions are recommended.
First, test your button click event tracking in Google Tag Manager
We will use the debugger/preview mode of Google Tag Manager to test the button click event tracking. We need to see if the tag is “firing”.
Preview -> Connect to your site -> Click the button you want to track in Google Analytics -> Look into the debugger/Tag Assistant data -> Tags:
Here you can see all active tags that have been fired and have not been fired.
Second, test your button click event tracking in Google Analytics
Now, we need to verify the button click tracking In Google Analytics:
After you simulated the button click on the website, navigate to Realtime -> Events
Here you should see the button click event goal:
Trouble-shoot button click tracking in Google Analytics
This is not a complete list of possible errors, but some common mistakes:
- Google Analytics UA tracking is correctly set up on the website AND Google Tag Manager
- All click elements are enabled in Google Tag Manager
- The button click variables match the tag configuration (step 4)
- The event goal in Google Analytics match the tag conditions of the Google Tag Manager Tag
- The Google Tag Manager updates have been published to the live site
If you can checkmark all of the above, I suggest widening the tag conditions in Google Tag Manager to all clicks. Then, verify the button click tracking in GTM and Google Analytics again. If it works, narrow the tag conditions further down with parameters like Click Class, Click Text, or Click URL.
Tracking more than button clicks in Google Analytics
You can track any clickable item on your website with event tracking in Google Analytics and Google Tag Manager. Some use-cases of tracking clicks are…
- non-gated content links to PDF documents that can’t be tracked in Google Analytics
- Phone or email links as contact requests/CTA
- Important links to external resources. For example, to show the CTR of your website to strategically placed links
- Social share button clicks
- Image clicks
Sascha is a Lifecycle Marketing Consultant with over 8 years of digital marketing experiences in Silicon Valley, the UK, and Germany.
After leading the demand generation for a 100+ million company, he decided to venture out on himself. He’s now helping clients to attract and convert more leads and customers.
His main focus are SEO, paid media & marketing automation – all with the focus to tie marketing campaigns to revenue.
Sascha has been featured in industry publications.