Google Tag Manager

⌘K
  1. Home
  2. Google Tag Manager
  3. Google Tag Manager Tracki...
  4. Tracking Clicks and Sending Events to GA4 via GTM

Tracking Clicks and Sending Events to GA4 via GTM

Objective

Track user clicks (on buttons, links, icons, etc.) and send them to Google Analytics 4 as custom events using Google Tag Manager.

Step 1: Enable Click Variables in GTM

  1. In Google Tag Manager, go to Variables
  2. Click “Configure” (top-right)
  3. Under the Clicks section, enable the following:
  • Click ID
  • Click Classes
  • Click Text
  • Click URL
  • Click Element (optional)

Step 2: Enable Click Trigger for Testing

  1. Go to Triggers → Click “New
  2. Name the trigger: Click – All Elements Trigger
  3. Choose Trigger Type: All Elements
  4. Choose: “All Clicks
  5. Click Save

Step 3: Preview the Site to Identify the Element

  1. Click Preview in GTM
  2. Enter your website URL and connect
  3. Interact with the element you want to track (e.g., click a button)
  4. In the Tag Assistant debug window:
  • Click the click event
  • View the values of variables like Click TextClick Classes, or Click ID

Choose a value that’s unique to this button or link (e.g., the button text is “Download This File“)

Step 4: Create a Specific Click Trigger

  1. Go to Triggers → Click New
  2. Name it: Click – Download This File
  3. Trigger Configuration →  All Elements
  4. Choose: “Some Clicks
  5. Set a condition, for example:
  • Click Text equals Download This File
  • Click Classes contains btn-download

6. Click Save

Choose the most reliable selector based on your site’s code.

Step 5: Create the GA4 Event Tag

  1. Go to Tags → Click New
  2. Name it: GA4 – click_download_file
  3. Tag Configuration → Select Google Analytics: GA4 Event
  4. Choose your GA4 Configuration Tag
  5. Set Event Name to: click_download_file
  6. Add Event Parameters (optional but helpful):
Parameter NameValue
button_text{{Click Text}}
page_path{{Page Path}}
click_url{{Click URL}}

     7. Scroll to Triggering → Select your click trigger (Click – Download This File)

     8. Click Save

 Step 6: Preview and Test

  1. Click Preview again in GTM
  2. Click the button/link on your site
  3. In the Tag Assistant window:
    • Check that your click event appears
    • Confirm your GA4 Event tag fires
    • See that the correct parameters are passed
  4. Go to GA4 > Realtime Report to see if the event appears

Step 7: Publish the Container

  1. Click Submit → Publish
  2. Name the version: GA4 Click Tracking – Download Button

Note

  • Use unique Click Text or IDs for accuracy
  • For multiple buttons, consider a Lookup Table or a more dynamic setup
  • If you’re tracking links, you can use a trigger type: Just Links instead of All Elements

How can we help?