Don't have one? Create one ↗
← All courses

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

  1. Enable Click Text

    1. Go to Variables in the left sidebar and click Configure at the top of the Built-In Variables section.
    2. Switch on Click Text. It holds the visible text of whatever was clicked.
  2. Create the trigger

    1. Go to Triggers in the left sidebar and click New.
    2. Click the trigger-type box and choose Click → All Elements.
    3. Set it to Some Clicks so a condition appears.
    4. Set the condition to Click Text equals Start free trial.
    5. Name it Click - Start free trial and Save.
  3. Tag: Custom HTML - Test

    1. Go to Tags → New and choose Custom HTML.
    2. Paste <script></script> (it fires but does nothing) and name it Custom HTML - Test.
    3. 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.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

Clicking Start free trial adds a 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

0 of 15 lessons complete