Phone and Email tracking with Google Analytics and jQuery


  • Handle tag manager’s dataLayer and new Analytics gtag into script
  • Correctly print out log

As explained in email tracking and phone call tracking articles before, it’s possible to track phone and email click using Google Analytics event. Now what if we want to track both of them?

We can simply copy and paste from both articles and it will work fine. Alternatively, we can consolidate the two scripts into one and save some spaces.

The requirement for this script to run successfully is still the same. You need to have the phone number and email wrapped in <a> tag.

  • For email, the <a> tag needs mailto: in the href.
  • For phone number, the <a> tag needs tel: in the href.

So your email and phone number should look like below:

Phone Number:

Now you can put the following script after you load Google Analytics and jQuery.

What does the above script do?

The above script listens to any <a> tag that is clicked. If there is any mailto: or tel: on the href on the <a> tag, it will fire Google Analytics event tracking under

  • Email
    • Category: Email
    • Event: Click
    • Label: email address
  • Phone Number
    • Category: Call
    • Event: Click
    • Label: email address

Leave a reply:

Your email address will not be published.