Google Tag Manager button click tracking is a button where with one click we can get into Google Analytics without any need for the code of your website.
If you are a beginner to Google Tag Manager then just check out this complete guide to Google Tag Manager as we are going to use some advanced steps in GTM.
Google Analytics pageview tag should be linked with the Google Tag Manager.
We need to check the source code as we are going to show you source code images in this blog from Google Chrome, so if you are using other browsers then steps to view source code may vary.
First, find the button on your website for which you want to do the tracking. For this, we are going to use the signup button of my email newsletter.
Now, tap the right click on your mouse and select the “Inspect” button and go into the source code page. (For Chrome users)
For other users check-in ‘How to get into source code page of (Your browser)’
On the source page, you will be able to see a button (number 1) located in the form (number 2) that has a class of “newsletter-form-button-label Yes count me in” (number 3) which means that your GTM’s button tracking is working.
Now, enable the build-in variable from the Google Tag Manager.
Google Tag Manager has a number of built-in variables that provide descriptions of specific experiences when the tags and activators are configured.
Now, under ‘Build-in Variable’, select ‘Variables’ and click on ‘Configure’
On the source page we saw that in the form, we identified the button’s class. Now we need to scroll down and check the ‘Form Classes’ option.
To send data to Google Analytics, we need to create our tag in GTM. Select ‘Tag’ and then click on ‘New’ in order to build them and name your tag.
Now tap on ‘Tag Configuration’ and choose ‘Google Analytics’ as the ‘Tag Type’
Go to the ‘PageView’ button and tap on it and change it to ‘Events’. Now choose the number of clicks you want to be triggered in Google Analytics.
First, we have to choose our configuration variable for Google Analytics.
We need to add a trigger before saving our new tag…
In order to generate a trigger, we must choose “triggering” for the tag and then click on the upper right corner of the Plus button.
Name the trigger now, for eg. ‘Button Click – Email Sign Up’ and click ‘Trigger Configuration’ and select ‘All Elements’
Now, the trigger has to be changed to just fire a few taps. Select ‘Form Classes’ and ‘Equals.’ When we display our page source code, we join the class we found. I entered the newsletter-form-button-label in my example.
After we save the trigger, we save the tag.
Go to the top right corner of the page and click on the “Preview” button, then a new window will load our website.
Underneath the page, the debug console for the Google Tag Manager is opened. After you load the debug console, press the on-site button, and then you see a summary on the left side of the console to refresh. (number 1)
You can tap on the command key on your computer by clicking on your mouse. Often, the confirmation page will be loaded into a new tab. It doesn’t always work, so I recommend that you go to Google Analytics to verify that your Tag is firing properly.
After you open up the reporting view in GTM, go select the “Real-Time” and after that select “Events.” This will show us Real-Time reports on Google Analytics.
After you see your results, click on Google Analytics, it is time for the container to be published on your website. Go back to the Google Tag Manager to do this by clicking ‘Submit’ in the right top corner.
Click on the tracking button in Google Analytics.
In addition to the Real-Time reports, you can also find button-click data in the Events reports. To go there select ‘Behavior’, then ‘Events’, and then ‘Top Events’. You’ll be able to see ‘Button’ within the report once data is available.
Tap on the ‘Button’ and then select ‘Action’. Now the label that you set up inside Google Tag Manager will be seen.