How to Track Button Clicks in Google Tag Manager and Send Them to GA4
A step-by-step guide for marketers to track button clicks in Google Tag Manager and send them to GA4: choosing the right click trigger, finding a stable identifier, building the event tag, and fixing triggers that do not fire.
In short
To track a button click in Google Tag Manager, enable the built-in click variables, click the button in preview to see its ID, classes and text, then create a click trigger that fires on Some Clicks matching one stable value. Use All Elements for buttons and Just Links only for links, and attach a GA4 event tag.
To track a button click in Google Tag Manager (GTM), you need a click trigger that recognises that one button and nothing else, a GA4 event tag that the trigger fires, and a test in preview mode before you publish. The part that goes wrong is the trigger: either it is the wrong type for the element, or it matches on something that changes, such as button text a copywriter later edits. This guide walks through the setup in order, then lists why click triggers fail and how to fix each cause.
First, check whether GA4 already records the click
If enhanced measurement is on (in GA4: Admin, Data collection and modification, Data streams, your web stream), GA4 already records two kinds of click without any GTM work. Outbound clicks, meaning links from your domain to another website, arrive as an event called click with parameters such as link_url and link_domain. File downloads arrive as file_download when someone clicks a link to a file with a common extension, including pdf, docx, xlsx, csv, zip, mp4 and mp3. Our guide to GA4 enhanced measurement events lists every event and its limits.
It does not record a click on a button that stays on your site, such as add to cart, open chat or a book-a-demo button that opens a pop-up. Those need a trigger of your own. Taps on phone and email links have their own quirks, covered in tracking tel: and mailto: link clicks.
All Elements or Just Links: which trigger your button needs
GTM has two click trigger types. Google's help page defines All Elements as tracking clicks on any page element, such as links, images or buttons, and Just Links as tracking clicks only on HTML a elements, the standard link tag. Many buttons are really styled links, and many are not links at all. To check, right-click the button in Chrome, choose Inspect, and look at the highlighted line. If it starts with a, it is a link. If it starts with button, div or span, it is not, and Just Links will never fire for it.
| Trigger type | Fires on | Use it for |
|---|---|---|
| Click - All Elements | A click on any element, including buttons, images and icons | Buttons that are not links, and any case where you are unsure |
| Click - Just Links | A click on a standard link (an a element) only | Links, including buttons styled as links, especially ones that load a new page |
When in doubt, use All Elements. It catches links too, but lacks the two Just Links options explained below.
Step 1: find what identifies the button
GTM fills a set of built-in click variables every time a click trigger runs. Click ID is the element's id attribute, Click Classes is its class attribute, Click Text is its visible text, Click URL is the address a link points to, and Click Element is the element itself.
- 1In your GTM workspace, open Variables, click Configure in the Built-In Variables section, and tick Click Element, Click Classes, Click ID, Click URL and Click Text if they are not already on.
- 2Go to Tags, click New, choose Google Analytics: GA4 Event as the tag type and enter your Measurement ID. Leave the event name as a placeholder for now.
- 3Under Triggering, create a trigger of the type you chose and leave it on All Clicks for now: click data only shows in preview when a click trigger is active.
- 4Save, click Preview in the top right, enter your page address and click Connect.
- 5Click the button on your site. In Tag Assistant, select the new Click event (or Link Click for Just Links) in the left-hand list and open the Variables tab.
- 6Note the values of Click ID, Click Classes, Click Text and Click URL, then click one or two other buttons to see which values are unique to yours.
If Tag Assistant will not connect at all, the problem is usually the browser rather than the container; our guide to GTM preview mode not working covers the usual causes.
Step 2: narrow the trigger to one stable condition
Open the trigger again, switch This trigger fires on to Some Clicks, and add one condition built from the most stable value you found.
| Variable | Example condition | How stable it is |
|---|---|---|
| Click ID | Click ID equals book-demo | Best when present: an id is meant to be unique on the page |
| Click Classes | Click Classes contains js-book-demo | Good if the class is specific to this button; risky if it is a generic style class such as btn |
| Click URL | Click URL contains /checkout | Good for links; empty for buttons that are not links |
| Click Text | Click Text contains Book a demo | Weakest: breaks when the wording changes, and differs on translated pages |
Google's GA4 events walkthrough uses Click Text, which works until someone rewrites the label. IDs and classes can change in a redesign too, so if the button has nothing unique, ask your developer to add a dedicated id or a data attribute that exists only for tracking, such as data-track="book-demo", and agree that it stays when the design changes. A data attribute is matched with the condition Click Element matches CSS selector [data-track="book-demo"].
Google also recommends limiting a click trigger to the pages where you expect the click, for performance. If the button only appears on the pricing page, add a second condition such as Page Path contains /pricing.
The two Just Links options
- Wait for Tags: holds the link's navigation until your tags have fired or a time limit runs out, set in the Max wait time field, 2000 milliseconds by default. Turn it on for links that load a new page, so the hit is not lost.
- Check Validation: when ticked, tags fire only for clicks GTM considers valid; when cleared, they fire on any link click. If another script on the page cancels the click's default action, a ticked Check Validation stops your tag, so leave it cleared unless you know you need it.
Step 3: build the GA4 event tag, test and publish
Back in the GA4 event tag, name the event in lowercase with underscores, such as book_demo_click. GA4 event names are case sensitive, must start with a letter and cannot contain spaces, so Book_Demo_Click would be a separate event. In the tag's parameters section, add a parameter named button_text with the value {{Click Text}} so you can tell variants apart later. Custom parameters such as button_text only appear in standard reports after you register them as custom dimensions, which our guide to GA4 custom dimensions explains.
- 1Save the tag, refresh Preview and click the button again. Tag Assistant should show the GA4 event tag as fired for that Click event, and only for that button.
- 2Click a different button and check that your tag did not fire this time.
- 3In GA4, open Admin, then DebugView under Data display, or the Realtime report, and confirm book_demo_click arrives. Preview mode turns on debug mode for your own browser.
- 4In GTM, click Submit, choose Publish and Create Version, name the version after the change, and click Publish.
If the click matters as a goal, mark it as a key event: in GA4 open Admin, then Events under Data display, find book_demo_click on the Recent events tab and click the star. Google notes that this counts only from the moment you mark it and can take up to 24 hours to appear in standard reports.
Why your click trigger is not firing
| Symptom | Likely cause | Fix |
|---|---|---|
| No Link Click appears in preview when you click the button | Just Links is used on an element that is not a link | Switch the trigger to All Elements |
| It fires when you click the edge of the button but not the icon or label | With All Elements, the clicked element is the inner icon or span, which has no ID or class of its own | Use Click Element with the matches CSS selector operator, for example #book-demo, #book-demo * to include everything inside the button |
| It worked for months, then stopped after a site update | The redesign changed the id, class or text you match on | Recheck values in preview; ask for a tracking-only data attribute |
| Nothing at all registers when you click | The button sits inside an iframe from another domain, such as an embedded widget | Use the widget's own events or a container inside the iframe |
| The tag fires on every click on the page | The trigger is still on All Clicks, or the condition matches a shared class such as btn | Switch to Some Clicks with a condition unique to the button |
| The tag fires in preview but the link opens a new page and GA4 gets nothing | The page unloads before the hit is sent | Use Just Links with Wait for Tags ticked |
The iframe case is common with booking, chat and form widgets: browsers stop a page from reading the contents of a frame from another domain, so no trigger setting helps. Our guide to tracking embedded forms and iframes covers the workarounds for the common providers.
When a click is the wrong thing to measure
A click tells you someone intended to do something, not that they did it. That matters most when the click leads to a conversion that happens elsewhere.
- Submit buttons: a click on Send also fires when a required field is empty or validation fails, so a click count runs higher than real leads. Track the confirmed submission instead, as explained in how to track form submissions reliably.
- Checkout and payment buttons: the purchase is the conversion; the click is a step in a funnel.
- Add to cart: fine as an engagement signal, but an add_to_cart event in GA4 is meant to carry item details, which a basic click tag does not send. Ask your developer or platform for a data layer push if you need product-level reporting.
- Buttons that open a chat, a pricing calculator or a brochure: here a click is often the best available signal.
The rule: track clicks for insight, and mark as key events only the clicks that are the outcome you want, not a step before it.
Frequently asked questions
Can I track button clicks in GA4 without Google Tag Manager?
Partly. Enhanced measurement records outbound link clicks and file downloads on its own, and GA4 can create a new event from an existing one in the interface. A click on an ordinary button that stays on your site, such as an add-to-cart or open-chat button, sends nothing to GA4 by itself, so you need Tag Manager or code on the site to send it.
Should I use one trigger for all my buttons or one trigger per button?
If the buttons share a pattern, one trigger and one tag are easier to maintain. Give every tracked button the same class or data attribute, match on that, and send the Click Text or Click ID as a parameter so you can tell them apart in reports. Use separate triggers when each button needs its own event name or a different destination.
Can the same click trigger also send the click to Google Ads or Meta?
Yes. A trigger can fire any number of tags, so you can attach a Google Ads conversion tag or another platform's tag to the same click trigger and keep one definition of the click. Before you do, decide whether that click really is a conversion you want bidding to optimise for, because a platform will look for more people who click, not more customers.
Sources
- 1.Click trigger - Tag Manager Help
- 2.Built-in variables for web containers - Tag Manager Help
- 3.Set up Google Analytics events in Tag Manager - Tag Manager Help
- 4.Enhanced measurement events - Analytics Help
- 5.Mark events as key events - Analytics Help
- 6.Google Tag Manager Click Tracking with GA4 (2026) - Analytics Mania
Try EndFrame
Add a server-side path for your conversions.
EndFrame collects events first-party and forwards conversions server-side to Meta, GA4, TikTok, and webhooks with event-ID deduplication — then credits each conversion to its campaign, with the visit-to-conversion path you can audit.
No credit card required