How to Create a Custom Button Click Tracking Event in GTM

Modified on Mon, Aug 3 at 12:24 PM

  1. Add a Unique Attribute (ID) to the button:

    1. In the editor, click on your button to place your cursor on the link.

    2. Click the link icon in the toolbar to open the link manager popup window.
    3. Click on the Advanced tab and in the ID textbox field add a custom ID (the ID cannot have spaces).

    P5#yIS1

  2. Enable Built-in Click Variables in GTM:

Inside Google Tag Manager:

  1. Go to Variables Configure (under Built-In Variables).
  2. Check all options under Clicks (Click Element, Click Classes, Click ID, Click Target, Click URL, Click Text).

Note: This only needs to be done once per GTM account so it may already have been completed.

 

3. Create the Click Trigger:

  1. Go to Triggers New.
  2. Choose trigger type: Click - All Elements (or Click - Just Links if it's an <a> tag which in the case of a button it is).
  3. Set it to fire on Some Clicks.
  4. Define your condition using the attribute from Step 1 (e.g., Click ID equals SubmitAbstract).
  5. Name and save the trigger (e.g., Trigger – Abstract Submit Button Click).

4. Create the GA4 Event Tag:

  1. Go to Tags New.
  2. Choose tag type: Google Analytics: GA4 Event.
  3. Select your Measurement ID (or GA4 Configuration Tag).
  4. Set Event Name using recommended snake_case naming (e.g., abstract_button_click).
  5. (Optional) Add Event Parametersif you want to pass extra metadata:
    • Parameter Name: button_location | Value: hero_section
  6. Attach the trigger you created in Step 3 to this tag.
  7. Save the tag.

5. Preview and Test, then Publish Changes:

  1. In GTM, click Preview to launch Tag Assistant and visit your live page.
  2. Click the target button on your site.
  3. Verify in Tag Assistant that your tag Fired.
  4. Open GA4 Admin DebugView to confirm the event appears in real time with its parameters.
  5. Once verified, click Submit in GTM to publish your changes.

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article