Google Analytics event tracking tracks anything that a user clicks on your website. This can include clicking phone numbers, email address, download links, sign-ups, form submissions, outbound links or any other calls-to-action.
Below is an example of basic link code that triggers a phone call when the "CALL (855) 482-4242" is clicked on from a mobile device.
<a href="tel:18554824242">CALL (855) 482-4242</a>
Here is what the Google Analytics tracking component is made up of:
onclick="ga(‘send’, ‘event’, ‘category’, ‘action’, ‘label’, value, {‘NonInteraction’: 1});"
For our phone call tracking event, the variables are defined as so:
Category = Phone Call Tracking
Action = Click to Call
Label = 855-482-4242
Value = (none)
NonInteraction = (none)
In the scenario, the category is called “Phone Call Tracking” to make it easier to track phone calls across the entire site. The action is called “Click to Call” to identify that the user needs to click on the phone number to initiate the action. The label has been set to “855-482-4242” because this is the phone number that is being clicked and tracked.
For this example, we won't assign the event a value, so it doesn’t need to appear in our code. The NonInteraction option is set to false by default, but if we want to assign it as true we can do so by defining the variable within two curly brackets and setting it to ‘1, ’ ie {‘NonInteraction’: 1}
Now that we have planned out the event we can put it all together!
This is what our Google Analytics phone tracking code looks like:
onclick="ga('send', 'event', 'Phone Call Tracking', 'Click to Call', '855-482-4242', 0);"
To add the phone call event code we need to add it to our original link. The section in red below is the event code that we defined in the prior step.
<a href="tel:18554824242" onclick="ga('send', 'event', 'Phone Call Tracking', 'Click to Call', '855-482-4242', 0);">CALL (855) 482-4242</a>
You're almost done! Before you call it a day, the event needs to be tested to ensure it is working correctly. Testing the event can be done in real-time from your Google Analytics account. After you log in to your account, go to the “Reporting” tab and click on the “Real-Time” option and then “Events.”
In a separate tab or window, go to your website and click on the item that has the event coded - this is the phone number link in our example. Switch the tab or window back over to Google Analytics, and you should see the event pop-up a few seconds after you click it. A properly setup event will display the Category, Action and Label that we assigned in step 1.
And there you have it - you can now measure the phone call clicks coming from your website!