Easily Track Button Clicks in Google Analytics 4 — Transcript
Full transcript
- 0:00Hey there, I'm Benjamin from Loves Data.
- 0:02In this video, I'm going to show you how to track button clicks in Google Analytics 4
- 0:06with the help of Google Tag Manager.
- 0:08The technique I'm going to share is the quickest and easiest way I've found to track buttons.
- 0:13I hope you like it!
- 0:18To track buttons, we're going to use Google Tag Manager.
- 0:21So if you're not using GTM yet, I've included a link to my tutorial series in the description
- 0:26below this video.
- 0:27And if you run into any issues as you're following along, please let me know in the comments.
- 0:32Okay, let's head to Google Tag Manager.
- 0:35To track button clicks in Google Analytics 4, we will need to create a tag and trigger.
- 0:41The trickiest step will be to configure the trigger to only fire our tag for the specific
- 0:46button (or buttons) we want to track.
- 0:49So we're going to use another trigger, along with some variables to help us identify the
- 0:55best way to track the button.
- 0:58This should make it easier to get up and running quickly.
- 1:01To do this, let's navigate to 'Triggers'.
- 1:09And let's create a new trigger.
- 1:16Let's name the trigger 'All Elements'.
- 1:22Now let's select 'Trigger Configuration'.
- 1:26And let's select 'All Elements'.
- 1:30This trigger will fire every time we click something on our website.
- 1:34So it's going to help us identify how to track our button.
- 1:39Now let's save the trigger.
- 1:42Next, we need to navigate to 'Variables'.
- 1:51And let's select 'Configure' at the top.
- 1:55This lets us enable and disable the built-in variables.
- 2:01If you're just getting started with GTM, the built-in variables allow you to use different
- 2:05pieces of information that are available on your website.
- 2:09For example, the 'Page URL' variable lets you use the full URL someone has loaded on
- 2:14your website.
- 2:16Now I want you to look for 'Clicks'.
- 2:19And I want you to enable all of the built-in 'click' variables.
- 2:29These will allow us to see details about the elements we click on our website.
- 2:33I also want you to go ahead and enable all of the built-in variables under 'Forms'.
- 2:40This is because buttons can be contained inside forms on our website.
- 2:44By enabling the click and form variables it makes it easier to identify the best way to
- 2:50track our buttons.
- 2:52Once we've identified how we'll track our button, we can come back here and disable
- 2:57any of the built-in variables we're not using.
- 3:00Okay, now let's close this.
- 3:04And let's click 'Preview'.
- 3:11We enter the URL of our website.
- 3:16And click 'Connect'.
- 3:21Our website loads.
- 3:23Next, we need to find the button we want to track.
- 3:27On my demo website, I want to track when people click on the 'Search' button, so let's scroll
- 3:32down.
- 3:33And let's click the button.
- 3:37Now let's open Tag Assistant.
- 3:42On the left, we need to look for the 'click' event.
- 3:46Let's select this.
- 3:49Now let's select the 'Variables' tab.
- 3:53This shows us the values for all of the variables we've enabled in GTM.
- 3:58We can see our 'Click' variables.
- 4:01And further down we can see our 'Form' variables.
- 4:06If you're tracking a button contained in a form, then you might want to use one of the
- 4:10'Form' variables.
- 4:12Or if you want to track a button that's not contained in a form, you might want to use
- 4:16one of the 'Click' variables.
- 4:19The main thing you need to look for is something unique about the button you want to track.
- 4:25For example, if you just see 'Submit', then this is likely to be used for multiple buttons
- 4:30on your website, so using something like that might mean your tracking additional button
- 4:37clicks.
- 4:38For my button, we can see the 'Form Classes' has a value of 'search', 'dash', 'submit'.
- 4:46Since it includes 'search' and 'submit', this is likely to only be used for the search button.
- 4:52So let's copy this.
- 4:54And we will also need to remember that we will be using 'Form Classes'.
- 5:02Now let's head back to GTM.
- 5:05We're still looking at the variables, so while we're here, let's disable the built-in variables
- 5:10that we won't be using.
- 5:12To do this, let's select 'Configure'.
- 5:16And let's disable the variables we enabled but aren't going to use.
- 5:27We just need to leave 'Form Classes' enabled.
- 5:34Now let's close this.
- 5:36And let's navigate to 'Triggers'.
- 5:40We're going to edit the 'All Elements' trigger we created to only track clicks on our button.
- 5:49To do this, let's select the trigger.
- 5:54Let's rename the trigger 'Click, Button, Search'.
- 6:04And let's select 'Trigger Configuration'.
- 6:08Now let's select 'Some Clicks'.
- 6:10And let's select 'Form Classes' from the drop-down.
- 6:13Remember, this is the built-in variable we used to identify the button on our website.
- 6:21Now let's change 'Contains' to 'Equals'.
- 6:25You might need to change this for your button.
- 6:28For example, if you found multiple values included in 'Form Classes' or the variable
- 6:34you're going to use, then you might want to leave 'Contains'.
- 6:38So you might need to use something slightly different for your trigger.
- 6:43Okay, now let's paste the value we copied from Tag Assistant, this was 'search', 'dash',
- 6:49'submit' for my example.
- 6:52Now let's click 'Save'.
- 6:57We've now created our trigger, so the final step is to create our tag.
- 7:02To do this, let's navigate to 'Tags'.
- 7:08We can see there is already a Google Tag that's sending data to Google Analytics.
- 7:13If you're getting started with GTM, then you might not have this yet.
- 7:18So again, I recommend watching my GTM tutorial series if you're just getting started.
- 7:24The link is in the description below this video.
- 7:28Now let's click 'New'.
- 7:32I'm going to name the tag 'Google Analytics, GA4, Search Button'.
- 7:45And let's select 'Tag Configuration'.
- 7:48Choose 'Google Analytics'.
- 7:50And select 'Google Analytics, GA4 Event' as the tag type.
- 7:55Now I'm going to select my Measurement ID variable.
- 8:02I'm going to name the event 'click', 'underscore', 'button', 'underscore', 'search'.
- 8:10You can name your event anything you like.
- 8:12However, I suggest following Google's recommended naming convention when tracking events into
- 8:18Google Analytics.
- 8:19To learn more about events and how to name them, I've included a link in the extra resources
- 8:24below this video.
- 8:26I'm also going to limit the number of times this tag is fired.
- 8:30To do this, let's select 'Advanced Settings'.
- 8:34And under 'Tag Firing Options', let's change 'Once Per Event' to 'Once Per Page'.
- 8:41You don't need to do this for your tag if you don't want to, but what this does is it
- 8:46means the button will only be tracked once per page, so if people manage to click the
- 8:51button multiple times on the page, it will only be counted once in our reports.
- 8:57Okay, now let's select 'Triggering'.
- 9:03And let's choose the trigger we just created.
- 9:08Now let's save our tag.
- 9:15And let's click 'Preview' to test our changes.
- 9:25Our website loads.
- 9:29Now let's scroll down.
- 9:31And click the button.
- 9:34And now let's open Tag Assistant.
- 9:40We can see our button tracking tag has fired.
- 9:46And let's select the Google Analytics Measurement ID at the top.
- 9:50We can see our 'click button search' has been set to Google Analytics.
- 9:55We can select this.
- 9:57And this shows us all of the information (called 'parameters') which are automatically sent
- 10:02with our custom event.
- 10:04When you're happy your buttons are being tracked correctly, you can publish your container.
- 10:09To do this, let's head back to GTM.
- 10:12And let's click 'Submit'.
- 10:16Name our version.
- 10:24And click 'Publish'.
- 10:28Moving forward, you will be tracking your custom event into Google Analytics.
- 10:33You will need to wait a day before data is available in your reports, but since I've
- 10:37already tested this out on my demo website, let's head to Google Analytics to take a look
- 10:43at how we can report on our button clicks.
- 10:47Let's navigate to 'Reports'.
- 10:52And select 'Engagement'.
- 10:55And then 'Events'.
- 10:56You will see your custom event in this report.
- 11:02And for even more flexibility you can create an exploration report to combine your event
- 11:07with other available dimensions.
- 11:11You will now be able to report on the number of times people click the button in Google
- 11:15Analytics.
- 11:16You can also use this method to send data to other platforms.
- 11:19For example, you could use the same trigger with a Google Ads conversion tag to track
- 11:24button clicks into Google Ads.
- 11:25Are you going to track buttons using GTM?
- 11:28I'd love to know!
- 11:29Let me know in the comments below.
- 11:31And to learn even more about Google Analytics and GTM, please take a moment to check out
- 11:35my courses.
- 11:36I've included a link in the description.
- 11:38Thanks for watching and I'll see you in the next video!
About this transcript
This page contains the full transcript of Easily Track Button Clicks in Google Analytics 4 by Loves Data, generated from the public captions YouTube serves with the video. The transcript has 1,453 words across 156 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.