Lesson 2 of 15
Click Text Triggers
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
Not every click is worth a tag, usually you want one specific button. GTM's Click → All Elements trigger can be narrowed to the visible text of whatever was clicked, using the built-in Click Text variable.
Here you'll fire a tag on just the Start free trial button while two decoy buttons stay silent, no IDs or classes needed.
Goal
Fire a tag on a single button matched by its visible text, using Click Text.
Build it in GTM
Enable Click Text
- Go to Variables in the left sidebar and click Configure at the top of the Built-In Variables section.
- Switch on
Click Text. It holds the visible text of whatever was clicked.
Create the trigger
- Go to Triggers in the left sidebar and click New.
- Click the trigger-type box and choose Click → All Elements.
- Set it to Some Clicks so a condition appears.
- Set the condition to
Click TextequalsStart free trial. - Name it
Click - Start free trialand Save.
Tag: Custom HTML - Test
- Go to Tags → New and choose Custom HTML.
- Paste
<script></script>(it fires but does nothing) and name itCustom HTML - Test. - Under Triggering, add the trigger from the previous step, then Save.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
Click event and your tag appears under Tags Fired with Click Text equal to Start free trial. The decoy buttons still add Click events, but your tag stays under Tags Not Fired.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded