This article shows how to configure custom button tracking with Google Tag Manager and Google Analytics.
Pre-requisites
- Google Analytics measurement is created and the "Enhanced Measurement" feature is enabled.
- Google Analytics is connected with Google Tag Manager
(Optional) Website Configuration
-
Name the button for easier filtering in Google Tag Manager later. For example:
<button id="myButton">Hello</button> <button class="track-this-button">World</button>
A common identifier would be the ID or the class name.
Google Tag Manager Configuration
-
Enable click-related built-in variables.

-
Create a new trigger for your button clicks. You can filter by specific criteria, such as button ID or class names.

-
Create a new tag to channel the event to Google Analytics and select the trigger in the previous step.

-
Click the preview button to test the changes you made.

-
Simulate the button click and confirm the event is being recorded.
-
Finally, you can click the submit button to publish your changes.
Observe the events in Google Analytics
-
You can now observe this event in Google Analytics. For example, in the realtime view:
