• Austin SEO
    • About TastyPlacement
    • TastyPlacement in the Press
    • Meet the Team
  • Blog
  • Services
    • SEO Services
      • WordPress SEO Service
      • Magento SEO Services
      • Conversion Rate Optimization
      • SEO Audit Service
      • Why Google Certification Matters
      • ChatGPT SEO & AI SEO Service
    • PPC & Google Ads
      • Google Ads & PPC Management
      • Remarketing Services
      • Display Ad Management
      • Facebook Ad Management
      • Google Ad Grants Management for Non-Profits
      • Adwords App Install Ad Management
      • Product Listing Ad Management
    • Analytics & Data
      • Analytics and Monitoring
      • Google Tag Manager Experts
      • Data Studio Development & Consulting
    • Social Media & Local Marketing
      • Social Media Marketing
      • Local SEO
    • Web Development
      • Mobile Website Design
      • WordPress Development
  • Case Studies
    • SEO Case Studies
      • SEO Case Study: We Beat Lowes, Then We Beat Home Depot
      • SEO Case Study: Total Domination in Houston for Medical Provider
    • Analytics Case Studies
      • Case Study: Updated Design Yields 43% Increase in Conversion Rate
      • Case Study: PPC Optimization Yields Tripled Conversion Rate
    • Social Media Case Studies
      • Social Media Case Study: Hundreds of New Customers From Core Facebook Campaign
  • Portfolios
    • Display Ad Portfolio
    • Design Portfolio
    • Infographic Portfolio
    • SEO Testimonials
  • Contact
    • New Customers: Get to Know Us
    • Customer Service & Support
    • Referral Program
    • SEO Training Seminars
    • Job: Paid Search/PPC/Adwords Analyst
    • Job: Local Digital Marketing Specialist
    • Job: SEO/Marketing Junior Analyst
    • Privacy Policy & Terms of Use
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu

Click to Call Tracking With Google Tag Manager: Tutorial

Analytics

…with a bonus: Mobile Device Detection (updated for July 2017)

Here’s the need: we have a responsive website, as pretty much 1/3 of the web has these days. We love receiving emails through our contact form from customers, and they are easy to track as Goals in Google Analytics and we feel they represent a more interested and more serious purchaser. But we also receive phone calls are those are more problematic: tracking a click to call hyperlink is easy if you assign Analytics event tracking to the click. But a problem arises: if desktop users click on the phone number looking for a contact page (they do), then the desktop user registers an event, polluting your Analytics goal tracking with meaningless clicks. So, can GTM be leveraged to only register mobile clicks on the click-to-call link?

GTM-goal-tracking-phone

So here’s what we want to do with Google Analytics and Google Tag Manager:

  • We want to create a tracking event that registers customer phone calls as an event/goal
  • We want to track only mobile phone clicks, and not errant desktop clicks to keep our data meaningful
  • We know we can do it with Javascript, but we want to do it in Google Tag Manager so all our tags are in one place and so that we can repeat the technique on any site without rewriting and installing the code on every site we work on

Getting Started: Create the Tracking Event (As a GTM Tag)

We assume you have a Google Tag Manager account and have a tag container installed on your site. You’ll create the event in Tag Manager, here’s a link to GTM if you are lazy; of course, you can always hire TastyPlacement for Google Tag Manager consulting if you need, but for now, let’s learn…

To create the event tracking, open your GTM account, navigate to “Tags” and click the “New” button and then select “Universal Analytics” from “Choose tag type”. You want your new tag to look like this screenshot–and you might have to return to these tag parameters to edit it because we haven’t created the “Call Now Click” trigger yet that is shown in the picture: Google Tag Manager screenshot Analytics tag

 

 

 

You don’t need to configure Google Analytics to create the event, Google Analytics will “listen” for our event and store events under “Behavior” and “Events”. Note how our choices of Category/Action/Label appear in our Analytics Account based on the settings above. We want the “Label” to tell us which URL the user was on when they clicked the button; that’s a powerful benefit of GTM that would be a quagmire if coding in javascript. With this little trick, we’ll know which page generated the conversion.

Analytics-event

 

Next, We Want To Fire Our Tag Only on Phones

Key to having good data  is to make sure the event is only triggered when the click is generated on a mobile phone, not a desktop or laptop computer which, obviously, has no phone capability. We can isolate phones among our website visitors by creating a user-defined variable in GTM that records each user’s browser width. Smaller screen width means mobile browsers (in nearly all cases).

Let’s browse in GTM to “Variables”, and in the “User-Defined Variables” section, click the “New” button. At the “Choose variable type” pop-up, select “custom JavaScript”, because we’ll be writing a few lines of code here.

We’ve named our variable “Pixel Mobile Screen Width Test”, and selected “Custom Javascript” as the Type and then entered the following small javascript string:

function () {
 var width = screen.width;
return width;
}

Our user-defined variable in GTM looks like this:

GTM-custom-javascript

 

What this string will do is set a variable based on the user’s screen width. In the next step well set a trigger that is dependent upon the screen width being below a certain pixel size–we want to fire our event only when  Does a narrower screen width necessarily mean the user is on a phone? No, not with 100% certainty, but for our purposes, it’s close enough.

While you’re in the variables section, enable the Click Url variable by clicking “configure” and then the checkbox. For some reason the pre-configured variables aren’t automatically available, you have to manually enable them.

Tying it All Together With a GTM Trigger

Now we tie together our screen width variable and our Google Analytics event tracking with a GTM Trigger to fire the event tracking and register our click in Google Analytics. In GTM, navigate to “Triggers,” then click the “New” button. We are going to create a trigger with the following parameters:

  • Event: Click
  • Configure Trigger: Just Links, Wait for Tags, Max wait time 2000 milliseconds, Check validation
  • Enable When: set this to “Pixel Mobile Screen Width Test” less than 800. That way the tags won’t spring into action unless it’s a mobile device.
  • Now to set when our tag fires: set to “Some Link Clicks” and change the “Click URL” to “matches RegEx” and then your phone number. It may be easier to just match the last four digits of the phone number, because if people have been putting hyphens in the tel:URLs, that will make a regular expression match a giant pain.
  • You might notice the “Page Path” argument–you won’t need that unless you have a specific page on which you do NOT want the tag to fire. In our case, we have some sample code that might have caused errant triggers, so we wanted to exclude that page.

 

 

So, let’s break this all down: under the “Fire On” section, we want to fire the event tracking when the Click URL matches 5125352492, which is the anchor text in our click to call link (our phone number, obviously). We have another condition though, which is that we only want to fire the event tracking when the screen width is less than or equal to 600 pixels, which refers to the user-defined variable we defined above. Save the trigger, and start testing. There are probably other (and better) ways of doing this, but this meets our requirements; it’s reliable and repeatable. Also, our method will work with anywhere we put a click to call button on our site. Maybe we have a link at the top of the page and at the bottom: either link would register as an event as long as the anchor text of the click to call link is the same. Also, I like how we’ve set the event tracking label to show the URL of the page the user was on when they decide to call.

For troubleshooting, you can use GTM in preview mode. Matthew Bey, our operations manager, developed this solution with lots of reference to Simo Ahava’s blog.

Here’s how I feel after completing this tutorial:

images

 

July 12, 2015/by Michael David
https://tastyplacement.com/wp-content/uploads/tagman.png 350 511 Michael David https://tastyplacement.com/wp-content/uploads/tastyplacementneedssvg.svg Michael David2015-07-12 21:12:042018-06-20 11:20:50Click to Call Tracking With Google Tag Manager: Tutorial
1 reply
  1. Panchito says:
    October 17, 2016 at 11:46 am

    Thanks, guys! Excellent information. I think I’ll implement this on my new site.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tutorials & Case Studies

  • Analytics
  • Case Studies
  • Infographics
  • Local Maps and Local Listings
  • Magento
  • Mobile SEO
  • Our Book: SEO for Wordpress
  • PPC
  • Programming & PHP
  • SEO
  • SEO Power Tools
  • SEO Resources
  • Social Media Marketing
  • Web Design
  • WordPress

Our Most Recent Tutorials & Case Studies

  • Tired of Expensive Website Uptime Monitoring Services? Build Your Own Uptime Monitor, 100% Free
  • Determining how and when Google Analytics 4 collects website event data
  • Infographic: Fonts & Colors That Drive the World’s Top Brands
  • Research Shows a 23% Divergence Between UA and GA4
  • How to Track Google Analytics Conversions on BuilderTrend’s iFrame Form

Search

Search Search

Archives & Tutorial Categories

  • Analytics
  • Case Studies
  • Infographics
  • Local Maps and Local Listings
  • Magento
  • Mobile SEO
  • Our Book: SEO for Wordpress
  • PPC
  • Programming & PHP
  • SEO
  • SEO Power Tools
  • SEO Resources
  • Social Media Marketing
  • Web Design
  • WordPress

Austin SEO Company, TastyPlacement

Click Here to Explore a Free Consultation

Our Most Popular Services

  • Austin SEO [Home]
  • WordPress SEO Service
  • PPC Management
  • Social Media Marketing
  • Analytics and Monitoring
  • Remarketing Experts
  • Conversion Rate Optimization

Let’s Talk: How to Get in Touch With Us

TastyPlacement Inc.
1214 W. 6th St. Ste 201
Austin, TX 78703
Tel: (512) 535-2492


Get Directions or Read Our Awesome Reviews on Google Maps
© Copyright - Austin SEO Company | TastyPlacement
  • Link to Facebook Link to Facebook Link to Facebook
  • Link to Instagram
  • Link to LinkedIn Link to LinkedIn Link to LinkedIn
  • Link to Pinterest
Link to: Is WordPress Good for SEO? Link to: Is WordPress Good for SEO? Is WordPress Good for SEO? Link to: How to Make a Mobile Site Click to Call Link Link to: How to Make a Mobile Site Click to Call Link How to Make a Mobile Site Click to Call Link
Scroll to top Scroll to top Scroll to top