How to Use Google Analytics To Track Survey Performance

If you've ever wondered which buttons on your survey page people actually click, Google Analytics 4 can tell you — but it doesn't happen automatically. This guide walks you through everything you need to set it up, from installing the base snippet to viewing your data in GA4 reports.
Why Track Button Clicks?
Pageviews tell you how much traffic your page is receiving. Button clicks tell you what they do. Knowing which calls-to-action get the most engagement lets you make smarter decisions about copy, design, and most importantly, conversion. It's the difference between guessing and knowing.
What Your Web Page Needs Before You Start
Your page needs the GA4 base snippet loaded first, otherwise gtag() won't be defined and nothing will work.
Step 1: The Base Snippet
Before any tracking can happen, your page needs to load the GA4 base snippet. This is a small piece of JavaScript that connects your site to your Google Analytics property. Paste it inside the <head> tag of every page you want to track, replacing G-XXXXXXXXXX with your own Measurement ID:
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
</head>After that, any gtag('event', ...) calls on the page will work.
Where to find your Measurement ID: In GA4, go to Admin → Data Streams → your stream. The ID starts with G-.
Without this snippet, none of the event tracking below will work — gtag() simply won't exist on the page.
Step 2: Fire an Event When a Button Is Clicked
Once the base snippet is in place, you can start sending custom events. GA4 uses a function called gtag('event', ...) to record user actions.
Option A: Inline onclick (quick and simple)
Add an onclick attribute directly to your button:
<button onclick="gtag('event', 'button_click', {
event_category: 'engagement',
event_label: 'Paste Review'
})">
Paste Review
</button>This works well for a small number of buttons, but can get messy if you have many to track.
Option B: Google Tag Manager (no future code changes needed)
If you use Google Tag Manager (GTM), you can set up click tracking entirely through the GTM interface — no further changes to your page code required. Here's how:
In GTM, create a new Trigger with type "All Elements" and configure it to fire on clicks matching your button's ID or class.
Create a new Tag of type "GA4 Event", name the event
button_click, and attach your trigger.Use built-in GTM variables like
{ {Click Text} },{ {Click ID} }, and{ {Click Classes} }as event parameters.
To use GTM, your page needs the GTM snippet instead of the gtag snippet — one in <head> and one immediately after the opening <body> tag:
<!-- In <head> -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- Immediately after opening <body> -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Step 3: Verify It's Working
Before you trust your data, confirm the events are actually firing.
GA4 DebugView is the fastest way to check. Add ?debug_mode=1 to your page URL, then go to GA4 → Admin → DebugView. Click your button and watch the event appear in real time.
GTM Preview Mode (if using GTM) lets you step through every tag that fires on a click, making it easy to confirm your trigger conditions are correct.
Don't rely on standard GA4 reports for testing — events can take 24–48 hours to appear there.
Step 4: View Your Data in GA4
Once events are confirmed and flowing, you can find your button click data in two places:
Reports → Engagement → Events — see total counts for your
button_clickeventExplore → Free Form — build a custom report, add
event_labelorbutton_idas a dimension, and compare clicks across different buttons
Tracking button clicks in GA4 comes down to three things: the base snippet on your page, a gtag('event', ...) call on click, and a few descriptive parameters to make the data useful. Whether you go with inline handlers, JavaScript listeners, or Google Tag Manager depends on how often your tracking needs to change — but all three approaches work well once the foundation is in place.
Once you have click data flowing, you'll have a much clearer picture of what's actually driving engagement on your site.