Apr 16, 2021

Tracking a button click as an event in GA4 without GTM

Hi there, I have a website on Google Sites that doesn't support GTM (which is crazy) and I have GA4 installed.

I'd like to set up two Events simply for button clicks. Without GTM, I can't seem to figure out if this is possible. GA4 is advertising itself as being able to easily track more events directly in the platform, but I can't find any documentation on setting up an Event for a simple button click.

To recap, this website won't support GTM. Is it possible to setup a 'button click' as an Event in GA4?

Thanks for the help.
Locked
Informational notification.
This question is locked and replying has been disabled.
Community content may not be verified or up-to-date. Learn more.
All Replies
Apr 17, 2021
The code for an event looks like:
 
gtag('event','button_click');
 
You need that to run when the button is clicked. e.g.
 
<button onclick="gtag('event','button_click');" 
 
 
false
747551061708714043
true
Search Help Center
true
true
true
true
true
69256
Search
Clear search
Close search
Main menu
false
false