Tracking Mobile Phone Calls in Google Analytics

Tracking phone calls that were made via a website can be tricky. Google Analytics can not track phone calls automatically. In order to track a phone call a recordable event must take place on the website that Google Analytics can record. Google Analytics will have no idea if someone on a desktop computer goes to your website and then picks up their phone and dials your number.

 Using HTML Phone Call Link Basics

It is best practice when you have a phone number on your website to surround it in a link, for example instead of having your phone number in the HTML look like this: <h3>1-800-CALL-DAN</h3>, You should place your phone number inside of an <a> tag, like: <h3><a href=”tel:18002255326“>1-800-CALL-DAN</a></h3>. Using the link with the tel scheme tells the browser this is a phone number, and when it is clicked, it activates the phone function of the mobile phone. This works great when making calls, however Google Analytics does not track your phone calls automatically.

Tracking Calls on Desktop Computers

This is impossible with Google Analytics. However you can aquire a tracking phone number from companies like Marchex. At companies like Marchex you can buy a 800 number or local number and then using their reports you can see how many phone calls your website or any marketing campaign has produced.

Are You Cheap and Only Care About Mobile Phone Call Analytics?

If you are cheap and want to only track mobile phone calls for free, I have created an easy to implement solution that only requires you to paste javascript into your website just before the closing </head> tag.

Generic Code that works in all versions of Google Analytics

This script finds all links that start with a tel: then it tells Google to record it as an event if someone clicks on the phone number:

<script><!--
if (typeof jQuery != 'undefined') {
 jQuery(document).ready(function($) {
 jQuery('a').on('click', function(event) {
 var href = jQuery(this).attr('href');
 if (href.substr(0,4) == 'tel:') {
 var phoneNum = href.substr(4);
 var elEv = []; elEv.value=0, elEv.non_i=false;
 elEv.category = "mobile call";
 elEv.action = "call";
 elEv.label = phoneNum;
 elEv.non_i = true;
 elEv.loc = href;
 if(window._gat){ //Classic
 _gaq.push(['_trackEvent', elEv.category, elEv.action, elEv.label, elEv.value, elEv.non_i]);
 }else{ //Universal
 ga('send','event', elEv.category,elEv.action,elEv.label,elEv.value);
 }
 setTimeout(function() {window.location.href = elEv.loc;}, 400);
 if ( window.console && window.console.log ) {console.log ( 'Called: ' + elEv.label);}
 return false;
 }
 });
 });
}
--></script>

This code is very generic and covers both Google Analytics Classic, as well as Google Analytics Universal.

Code for only Google Analytics Classic

<script><!--
if (typeof jQuery != 'undefined') {
 jQuery(document).ready(function($) {
 jQuery('a').on('click', function(event) {
 var href = jQuery(this).attr('href');
 if (href.substr(0,4) == 'tel:') {
 var phoneNum = href.substr(4);
 var elEv = []; elEv.value=0, elEv.non_i=false;
 elEv.category = "mobile call";
 elEv.action = "call";
 elEv.label = phoneNum;
 elEv.non_i = true;
 elEv.loc = href;
 _gaq.push(['_trackEvent', elEv.category, elEv.action, elEv.label, elEv.value, elEv.non_i]);
 setTimeout(function() {window.location.href = elEv.loc;}, 400);
 if ( window.console && window.console.log ) {console.log ( 'Called: ' + elEv.label);}
 return false;
 }
 });
 });
}
--></script>

Code for Only Google Analytics Universal

<script><!--
if (typeof jQuery != 'undefined') {
 jQuery(document).ready(function($) {
 jQuery('a').on('click', function(event) {
 var href = jQuery(this).attr('href');
 if (href.substr(0,4) == 'tel:') {
 var phoneNum = href.substr(4);
 var elEv = []; elEv.value=0;
 elEv.category = "mobile call";
 elEv.action = "call";
 elEv.label = phoneNum;
 elEv.loc = href;
 ga('send','event', elEv.category,elEv.action,elEv.label,elEv.value);
 setTimeout(function() {window.location.href = elEv.loc;}, 400);
 if ( window.console && window.console.log ) {console.log ( 'Called: ' + elEv.label);}
 return false;
 }
 });
 });
}
--></script>

Viewing the Phone Calls in Google Analytics

Now that the you have the code implemented, do a couple of test clicks on your phone numbers. I have added a console log response that will tell you if you have made a phone call. The console can be viewed in your browser’s developer tools, or FireBug. When you click on a phone number it will automatically record it in Analytics.

Note: after you implement and test this script, it may take Google Analytics up to 24 hours to have the event seen in the reporting, so be patient.

You can view your events in Google Analytics by going to: Behavior > Events > Overview.  The phone calls will have the Event Category: “mobile call”, the Event Action: “call”, and the Event Label of the phone number called.

Here is an example screenshot of the phone call event in Google Analytics:

analytics-mobile-call-tracking

 

In the event label if you have multiple phone numbers, it will list all of the phone numbers that had calls during that time frame.

Potential Call Tracking Issues

When someone clicks on the phone number it does not mean they actually pressed the send button and made the call, it just means they probably will. If someone on a device that can not make phone calls clicks on the phone number, it will be recorded in Analytics, but no phone call will be made.

I hope you enjoy my script.