Hey 👋 new reader,
Pluralsight gave me some free

1 month
subscriptions

, get them before
they are gone!

Track mailto and tel clicks in Wordpress with Google Analytics

· 1 min read Edit Post
How to easily add Google Analytics tracking code to mailto: and tel: anchor links.

It is useful to track when vistors interact with telephone and email links. With this Wordpress Plugin you can easily track how many times people click on these in just 1 minute.

Download a Wordpress Plugin

I created a Wordpress plugin to simply go through all the mailto and tel <a> elements on the page and add the Google Analytics tracking code to onclick.

Before:

<a href="mailto:[email protected]">Contact me</a>

After:

<a onclick="ga('send','event','Mailto Tracking: [email protected]','Click/Touch');" href="mailto:[email protected]">Contact me</a>

The plugin sends back to Google:

ga(
  'send',
  'event',
  'Mailto Tracking: [email protected]',
  'Click/Touch'
);

For tel links, it is the same.

Before:

<a href="tel:+0759606141">Bristol 0759606141</a>

After:

<a onclick="ga('send','event','Phone Call Tracking: 0759606141','Click/Touch');" href="tel:+0759606141">Bristol 0759606141</a>

The plugin sends:

ga(
  'send',
  'event',
  'Phone Call Tracking: 0759606141',
  'Click/Touch'
);

Open Source

I built the plugin and made it open source. Please request a new feature or improve it here.

Add the Wordpress plugin to your site to track mailto and tel presses!

Suggested

  • 1.1 Million SLOC — 28 October 2017
    I have contributed 1.1 Million Source Lines of code (SLOC) to open-source.
    • github
    • bash
  • The First Website I Built — 15 November 2017
    The first ever website I created and how I tried to improve it.
    • css
    • scss
    • html
    • php
return home