You may have already seen that tracking links is possible with events in Google Analytics, but what about email (mailto) or telephone (tel) links?
I know that the suspense is killing you, so here is the answer- Yes, of course, you can. Both the free and the Pro versions of WP Google Analytics Events allow you to track these links.
When you think of it, clicking a telephone number can be a form of conversion on your website. The same goes for email links. There is not much of a difference between them and contact form submits.
I can remember email links way back when websites still had that under construction gif (I sure did). It was, and still one of the basic ways to allow people to get in touch with you on the web. If you already have an email address in the contact information, why not make it a clickable link that opens up the user’s email client with the to: address already filled up. Magic!
An email or mailto link may look like this:
Telephone links are pretty much like email links, but when you click them, they will, when possible, open up an app that allows you to place telephone calls. On a computer, it may be Skype, and on a mobile phone, well, the dialer.
A telephone, or tel: link may look like this:
Tracking email and telephone links
Both email and telephone links are pretty much the same, so I’m going to cover both cases when it comes to tracking.
I will show you two ways of tracking these link types; One for individual links and another that will cover all the mailto or email links on the website with just one setting.
If you want to track specific mailto or email links and say, give them different labels, you will have to use the id or class attributes if they have them. For example, if we have the email link –
<a id=”sales-email” href=”mailto:firstname.lastname@example.org”>email@example.com</a>
You can create a click event with the selector “sales-email” and set the type to id. Then just fill in the category, action, and label.
What if I don’t have an id or class attribute for that link? Well, if you can add them then great, if not, the next section will cover that.
Track all the links
There is a trick that works both for tracking all the email/telephone links on the website, and for more specific links that don’t have a class or an id attribute.
The first thing that you will have to do, is to enable the plugin’s Advanced Mode. You can do that in the plugin’s General Settings tab by checking the option.
You can then head over to the Click Tracking section to set up the event.
For tracking all the email/tel: links no matter which address or number, use the following example:
Use the selector a[href^=tel] and set the type to advanced.
In the above example, we tell the plugin to track every link (a) that has the href (actual link) attribute that starts ^= with tel
For emails just replace tel with email
As always, you can set the category, action, and label to reflect the event details.
Pro tip (as in pro version)
Placeholders are great for these types of events. You can use the $$ATTR_HREF$$ placeholder in any of the fields to get the actual email or phone numbers that were clicked. The $$PAGENAME$$ placeholder will tell you on which page the visitor clicked the link.
$$ELEMENT_TEXT$$ will give you the actual link text.
Specific addresses or numbers
You can also create a global event, for whenever someone clicks an email/tel link with the same address or number, regardless of where he is on the website.
Suppose that you want to track clicks on the following telephone link:
You can create an event by using the following selector: