With medium- and large-sized companies, digital marketing is typically driven by two forces: the ideal, and the workaround. Sometimes, we’re given the freedom (and budget) to power through a challenge with the perfect solution. More often, however, we inherit hardware and a CMS that, despite its quirks and limitations, isn’t going anywhere anytime soon. In addition we need data to assess performance and plan strategically. However collecting data requires implementing tracking on our web pages, which requires resources not just from us but also from IT, every time we want to add or change our tags. If this is you, and you have a project that should have been done yesterday, Google Tag Manager (GTM) can be a real lifesaver — it’s given us the ability to make data tracking a reality without funneling your projects through the IT queue.

One simple and handy feature of GTM is its “Click Text” variable. This allows you to track interactions based on anchor text — including text-based buttons, menu items, content-based CTA’s, and more. I like to use it to isolate and track clicks on home-page-based callouts, to prove click degradation statistics in carousels, and as a awesome-man’s A/B test. However, when applied correctly, the possible applications abound.

For this tutorial, I’m assuming you’re brand new to Google Tag Manager, but already have it set up in V2, with the container code on the intended website and Google Analytics installed. We’ll be using lots of screen shots, and explaining every step along the way. If you have any questions, leave a comment and I’ll answer in a jiffy.

Four Steps to “Click Text” Event Tracking

For this example, we’re going to use my personal website as our guinea pig and configure tag manager to record an event every time someone clicks “Portfolio” from the top menu:

Google Tag Manager tracking anchor text

To do this, we’ll need to put a few elements in place. Google Tag Manager operates from three different pieces, each building on the previous. I’ll introduce them here and get into more detail as we go:

  • Variables: Variables define the condition that the trigger will work with. In this case, the conditions of the variable will be met when someone clicks on any link on my website that has the anchor text “Portfolio”.
  • Triggers: Triggers take the variable and add specific conditions to it. For example, while a variable comes into play whenever “Portfolio” is clicked, the trigger may broadened the condition so it fires when any anchor text starting with “Portfolio” is fired, or perhaps only when the anchor text does not match “Portfolio”.
  • Tags: Tags pull everything together, and are very powerful. When a tag is set to record an event, it will define which trigger(s) will activate it; which Google Analytics ID it will record to; what categories, actions, labels, and values will be used as it’s reported; and the pages/elements where it’s active.

In the case of click-text-variable-based event tracking, we’ll set up a tag using these four steps:

Step 1: Set Up Your Variable

Setting up click text variables in Google Tag Manager

Always build your tags from the bottom up, starting with the variable. When Google Tag Manager  is first set up, it only “listens” for a small number of variables. Click on “Variables” on the left-hand side to see which have been turned on, and ensure that “Click Text” is selected.

Step 2: Create the Trigger


Click-text tracking is simple, and in most situations, you should only need to create one trigger. Choose “Triggers” from the left-hand menu, and click “New”.


The screen above will appear. Name your trigger (I named mine “Portfolio Clicks). Next, choose “Click” from the event type.


Tag Manager will prompt you to choose between “Click” and “Link Click”. Choose “Click”.

Note: If you’re using V1 to create a “rule” (what V2 calls a trigger) , it’s important to remember to set it to “gtm.click” and not “gtm.linkClick” for this step.


Choose “Some Clicks” to connect your tag to a variable.


GTM will promt you to choose a variable from your existing list. Choose “Click Text” (which you activated in step 1).

Configuring trigger for click text tracking

Enter in the anchor text you’d like to track clicks to (I have mine set to track “Portfolio”). Next, click “Save Trigger”.

Step 3: Set Up Your Tag


Click on “Tags” from the left-hand menu, then click on “New” to build a new event.


At DragonSearch, we like to label event-tracking tags with “ET” to help us stay organized with large setups (say, 30 tags or more). I named this one “ET Click – Portfolio – Top Menu”. After naming your event, then choose the product you’ll be using to report with tag manager. If you’re new to Google Tag Manager, chances are pretty strong that you’re using Google Analytics.


Next, choose the type of analytics you’re using. If you’re not sure, one tool you can install to check (and do all sorts of useful things with later) is the Google Tag Assistant plugin for Google Chrome. Alternatively, if Tag Manager has other tags already set up, you can reference those to set up this one.


Google will then ask for your Tracking ID. If you don’t already know it, Google Tag Assistant can also provide you with this.


Finally, you’ll need to enter in your tracking parameters. Try to keep them simple and self-explanatory in a way that’s scalable for the day when your GTM profile grows into dozens of listings. Click on “Continue” once you’re done populating fields.


From here, choose “Click” under “Fire On.” Google will show you a list of existing triggers to choose from (like the view below). Select the one you created earlier (mine is named “Portfolio Clicks”) and click “Save”.


Step 4: Publish and test your work


To set the changes you’ve made live, click the “Publish” button on the top right, and “Publish Now” afterwards. This critical step can be very easy to forget, especially when you’re working with much more complicated tag setups.


After publishing your changes, go into Google Analytics (GA) and turn off any filters blocking your IP address so you can test your results. Use GA’s Real-Time feature to enter the website and test out the tracking. To make it look as natural as possible, I prefer to enter the website via Google search and click/scroll around a few pages before clicking. If it’s working properly, you should see your event appear within 60 seconds (usually immediately).

Trial and error is definitely part of the Tag Manager experience, and your first time using it is likely to be a bit awesome. The good news is that version 2 of Tag Manager is much easier to understand and work with than its predecessor.

When you’re ready for a more advanced challenge, I recommend you check Chris Berkley’s post on using GTM to track site searches with no results. Or, if you’re stuck on this, leave me a comment below, and I’ll be glad to help out!

This entry was posted on Thursday, July 16, 2015 and is filed under Content Marketing, Integrated Marketing.

Related Posts

Your thoughts? Please comment below.