Track Click to Call Links In Google Analytics Events Using Google Tag Manager

Google Tag Manager Google Analytics Event for Tracking Phone Number Clicks in an Anchor Tag

As we work with clients on reporting, it’s a necessity that we set up a Google Tag Manager account for them. Google Tag Manager isn’t just a platform to load all your website’s scripts, it’s also a robust tool to customize where and when you wish to trigger actions within your site using any scripts that you’ve included.

It’s typical that over half of all your site’s visitors are arriving on your site via a mobile browser. Hyperlinking your phone numbers on your site is a great way to make it easier for a visitor to give your sales team a call. We make sure that we hyperlink every phone number across all of our clients’ sites for just this reason. Here’s what that HTML anchor tag looks like:

<a href="tel:13172039800">317.203.9800</a>

Google Analytics Events offer the opportunity to measure events within a site. Events are a must for measuring interaction like clicking calls to action, starting and stopping videos, and other interactions within a site that don’t move the user from one page to another. It’s the perfect means to measure this type of interaction. To do so, we could modify the above code and add a JavaScript onClick event to append the event:

<a href="tel:13172039800" onclick="gtag('event', 'click', { event_category: 'Phone Number Link', event_action: 'Click to Call', event_label:'317.203.9800'})">317.203.9800</a>

There are a few challenges with this. First, you may not have access to add the onclick code within the fields of your site’s content management system (CMS). Second, the syntax has to be correct so there are a lot of opportunities to get it wrong. Third, you’ll have to do it everywhere you have a phone number on your site.

Event Tracking In Google Tag Manager

The solution is to employ the advanced capabilities of Google Tag Manager. As long as Google Tag Manager is implemented on your site, you never have to touch your content nor code to deploy event tracking like this. The steps to do so are as follows:

  • Trigger – Set up a trigger that is executed when a site visitor clicks on a phone link.
  • Tag – Set up an event tag that is processed each time the trigger is executed.

NOTE: A pre-requisite of this is that you already have a Google Analytics Universal Analytics Tag set up and properly firing on your site.

Part 1: Set Up Your Click Trigger

  1. Within your Google Tag Manager Account, navigate to Triggers on the left navigation and click New
  2. Name your Trigger. We called ours Phone Number Click
  3. Click in the Trigger Configuration section and choose the trigger type Just Links

Google Tag Manager > Trigger Configuration > Just Links

  1. Enable the Wait for Tags with a default max wait time of 2000 milliseconds
  2. Enable Check Validation
  3. Enable this trigger when a Page URL > matches RegEx > .*
  4. Set this trigger fires on Some Link Clicks
  5. Fire this trigger on Click URL > contains > tel:

google tag manager trigger configuration just links tel

  1. Click Save

Part 2: Set Up Your Event Tag

  1. Navigate to Tags
  2. Click New
  3. Name your Tag, we named ours Tel Click
  4. Select Google Analytics: Universal Analytics

Google Tag Manager > New Tag > Google Analytics: Universal Analytics

  1. Set the Track Type to Event
  2. Type in the Category as Telephone
  3. Click the + sign on Action and select Click URL
  4. Click the + sign on Label and select Page Path
  5. Leave the Value Blank
  6. Leave Non-Interaction Hit as False
  7. Enter your Google Analytics Variable.
  8. Click the Triggering Section and select the Trigger you set up in Part 1.

google tag manager tag telephone click

  1. Click Save
  2. Preview your Tag, connect your site, and click on your site to observe that the tag is fired. You can click on the tag Tel Click and see the details that were passed.

google tag manager preview

  1. After you verify your tag is properly firing, Publish the tag to put it live on your site

Tip: Google Analytics doesn’t track events typically in real-time for your site so if you are testing the site and going back into your analytics platform, you may not observe the event being recorded. Check back in a few hours.

Now, regardless of the page of your site, every click-to-call link will record an event in Google Analytics when someone clicks the telephone link! You can also set that event up as a Goal in Google Analytics. If you’d also like to do this with mailto links, we’ve written an article, Track Mailto Clicks In Google Analytics Events Using Google Tag Manager