Step 1: Google Tag Manager
A. Create a New Trigger
Give a name, set it up with ‘Just Links’
Click on ‘Some Link Clicks’
Use Click Classes if you’re looking to track a button specified by a class, use Click ID if you’ve given it an ID
I’ve found things usually work better if we’ve specified a specific page for things as well (I’ve had button tracking not work…until I’ve added a page URL as well, so I generally just do that now). So add another row to the list of conditions and use “Page URL” to specify which page will fire this button.
B. Create a New Tag
For “Triggering”, select the trigger you just created. For “Tag Configuration”, select Google Analytics: Universal Analytics (yeah, I’ll need to update this for using GA4).
For ‘Track Type’, select ‘Event’, Enter something for the Category, Action, and Label. I’m usually doing something like:
Category: CTA Buttons
Label: Sticky Header Button
Value: I normally just leave it blank
Just be sure to note what values you add for these. You’ll need to copy these values exactly in Google Analytics
For the Google Analytics Settings, I just usually select the analytics account number. I don’t really know what this does. I generally don’t update anything else here. Give it a name, and then click save.
Don’t forget to ‘Submit’ your changes in tag manager. After making the above, on the ‘Workspace’ page of tag manager, click the ‘Submit’ button in the upper right. Half the time when I’m wondering why the hell this isn’t working, it’s because those changes weren’t ‘published’.
Step 2: Google Analytics
- Go to ‘Admin’
- Click on ‘Goals’
- Click on ‘New Goal’
- For Goal Setup, click on ‘Custom’
- Give it a name
- For Type, select ‘Event’
- Click ‘Continue’
- For the Category, Action, and Label, enter the same exact values you added in Google Tag Manager
- Click ‘Save’
You can then visit the site, click on your button, and then in Analaytics go to “Realtime” and click on “Events” and you should hopefully see your click recorded (assuming of course that you aren’t blocking yourself from tracking). Usually if things aren’t working, I either haven’t actually submitted the updated version in Tag Manager, or there is some slight misspelling of the Category, Action, or Label in either Tag Manager or Analytics. I think I’ve noticed before where I’ll have a space or something after one of those, which caused an issue.