GUARDLABS
GuardLabs · Technical note

How to Track Button Clicks in GA4 with Google Tag Manager

Tracking specific button interactions—such as "Submit," "Download," or "Add to Cart"—allows you to measure user engagement in Google Analytics 4 (GA4). This guide walks you through the technical setup using Google Tag Manager (GTM).

Step 1: Enable Built-In Click Variables in GTM

Before creating triggers, ensure GTM is capturing the HTML attributes of the clicked elements.

  • In GTM, navigate to Variables in the left-hand menu.
  • Click Configure in the top-right corner of the "Built-In Variables" container.
  • Scroll down to the Clicks section and check the boxes for:
    • Click Element
    • Click Classes
    • Click ID
    • Click Target
    • Click URL
    • Click Text

Step 2: Inspect the Target Button

To target the correct button, you must identify its unique HTML attributes.

  • Go to your website, right-click the target button, and select Inspect (or Inspect Element).
  • Look at the HTML markup. For example:
<button id="promo-download-btn" class="btn btn-primary">Download Guide</button>

In this example, the unique identifiers are the ID (promo-download-btn), the class (btn btn-primary), and the link text (Download Guide). You will use these in the next step.

Step 3: Create a Click Trigger

This trigger tells GTM exactly when to fire the GA4 event tag.

  • Navigate to Triggers > New.
  • Name the trigger: Click - Download Button.
  • Click Trigger Configuration and choose Click - All Elements.
  • Under "This trigger fires on," select Some Clicks.
  • Define the condition using the attributes identified in Step 2. For example:
    • Click ID equals promo-download-btn
    • Or: Click Text equals Download Guide
  • Click Save.

Step 4: Create the GA4 Event Tag

Now, configure the tag that sends the click data to GA4.

  • Navigate to Tags > New.
  • Name the tag: GA4 Event - Button Click - Download.
  • Click Tag Configuration and select Google Analytics > Google Analytics: GA4 Event.
  • Enter your GA4 Measurement ID (or select your existing Configuration Tag/Measurement ID variable).
  • Set the Event Name. Use lowercase and snake_case (e.g., button_click).
  • Expand the Event Parameters section to pass additional context to GA4. Click Add Row:
    • Parameter Name: button_name | Value: Download Guide (or use the dynamic variable {{Click Text}})
    • Parameter Name: button_id | Value: {{Click ID}}
  • Click Triggering and select the trigger you created in Step 3 (Click - Download Button).
  • Click Save.

Step 5: Test and Verify

Verify the setup before publishing to prevent data discrepancies.

  • Click Preview in the top-right corner of GTM to launch Tag Assistant.
  • Enter your website URL and click Connect.
  • Perform the button click on your website.
  • In the Tag Assistant window, locate the click event in the left-hand timeline. Verify that your GA4 Event - Button Click - Download tag fired successfully.
  • Open your GA4 property, navigate to Admin > DebugView, and confirm that the button_click event is registering with the correct parameter values.

Step 6: Publish the Container

Once verified, click Submit in GTM, name the version, and click Publish to push the tracking live.

Note: To see your custom parameters (like button_name) in GA4 standard reports, you must register them as Custom Dimensions in GA4 under Admin > Custom Definitions.

Need this done fast? order it on Kwork.

Published 2026-06-23 2 min read All articles EN / RU / ES
Need help with this?

I take on freelance fixes and builds in this area.