Learn how users interact with buttons and use data to make informed website optimization decisions.
Right-click on the button and click Inspect. This will open a window displaying the source code for the button. Copy the class of the button; you can find it after the
class= tag. For example, the class of the preview button in Google Tag Manager is
Go to Variables > Built-in Variables and click configure, then select all the click variables in the list to activate built-in click tracking variables in Google Tag Manager.
- In the side navigation bar, click on Tags.
- Click on the New Button.
- Replace untitled tag with a descriptive name for example, sign up button tag.
- In the Tag configuration section, click on the pencil icon.
- Select Google Analytics: Universal Analytics from the list.
- Select Event as the track type.
- Enter button click in the category field.
- Enter the name of the button for example, sign up now in the action field.
- Click on the + icon next to label and select page URL as the variable.
- Click Enable override settings in this tag.
- Enter your Google Analytics tracking ID.
- Click on Trigger and then click on +.
- Click on the Trigger Configuration field and choose Clicks > All Elements from the list.
- Rename Untitled trigger to a descriptive name for example, sign up button trigger.
- Select Some clicks.
- Set the rule, click Classes > Contains > and enter the button class value that you identified earlier.
If you track additional buttons, make sure that the category field (button click) is the same across all buttons. Use different values in the action field to distinguish between different buttons. Use the same page URL variable for all your click events. Adjust the triggers in case your buttons have different click classes.
Go to Behavior > Events > Top events in Google Analytics and look for the button click event category to analyze your button clicks.
Total events indicates the total number of button clicks. Click on the event category which will show the button names that you defined earlier. On the same page, click on the event label, this will produce a list of pages on which your buttons were clicked.
Determine which button name is most effective in generating clicks. You can use this insight to optimize the calls to action on your buttons. Look at which pages generate most button clicks. If you use sign up buttons and contact us buttons, you can learn which page is most effective in generating clicks and drive more traffic to this page.