Analytics

Mailto links are sometimes the only option available for visitors who wish to initiate contact with a business via their website.

What Are Mailto Links?

It’s almost standard practice for commercial websites to display contact email addresses. In many cases, these are coded into the website as mailto links.

This means that the email address effectively becomes a hyperlink. When clicked, it allows users to send an email to a specific address without the need to copy and paste it into an email client.

This example website, Harris Balcombe, uses mailto links within the header, and so is present on every page of the site. By viewing the source of the page you can see how this is coded:

where to find a mail to link in the code of a website - this image shows the link on the site as it is normally viewed as well as the source code

The Problem with Mailto Links

Although I appreciate why mailto links exist, I have two main problems with them.

Firstly, depending on your operating system or browser, mailto links will have a default email client that opens when clicked. This is problematic if you don’t have the default client installed, or if this client isn’t your preferred choice to send and receive emails. This, of course, can be changed, but not everyone knows how to do this, or even that this is possible.

Secondly, mailto links pose a challenge for digital marketers when it comes to tracking and measuring KPIs and website performance. Mailto links leave a lot to speculation. Even if someone clicks on the mailto link, there is no certain way to be sure that they successfully managed to compose and send the email.

In terms of measurement, it’s better to use embedded contact forms. You can measure the completion of contact forms much more accurately and effectively within Google Analytics via event tracking, goals, or a mixture of the two.

On our website, we use both mailto links and contact forms because we want to make sure that we cater to everyone’s preferences. However, our contact forms are given much more prominence and we prefer to steer our visitors towards them. They are easier to complete, they capture all of the information we require, and they provide us with much more useful information with Google Analytics.

With all that said, if there are no other contact points on the website and mailto links are the only option, there is a way to measure interactions with these email addresses within Google Analytics using Google Tag Manager.

This post assumes that you have a knowledge of what Google Tag Manager is, that you have it set up for use with your website, and that you know how to use it.

If you’re new to Tag Manager, or if you need a refresher, read our introduction to Tag Manager.

Tracking Mailto Links Using Tag Manager

What follows is a step-by-step guide to setting up mailto link tracking using Google Tag Manager.

The first thing you will need to do once you have logged in to Tag Manager, is to create a trigger. In this example I have named the trigger “Mailto Link Clicks”:

Where to create a trigger in GTM for mail link clicks - this image shows the Google tag manager dashboard with the trigger box highlighted and a link to the relevant mailto link trigger

Then select the “Click” and “Just Links” Event Type:

creating a click and just links trigger in google tag manager to track mailto link clicks image guide

 

Next, you need to choose when Tag Manager should “listen” for these link clicks. This will depend on which pages contain a mailto email address.

In this example, the email address is in the header of the site. It therefore appears across all pages of the site.

This can be targeted by selecting the “Page URL matches RegEx .*” within the “Enable When” section. This will ensure that all pages listen out for the link click trigger:

tag manager -trigger configuration for mailto link clicks tracking

 

The next step is to define when you would like your trigger to fire. We, of course, would like the trigger to fire each time someone clicks on a mailto link on your website.

To achieve this, select “Click URL” – “contains” – “mailto” as shown below and save the trigger:

tag manager - trigger configuration for mailto link clicks which link to target

 

The next step is to fire the “Event” to Google Analytics. For this, you will need to create a new tag and connect it to the previously created trigger.

Name your tag appropriately. In this example I have opted for “Mail To Link Clicks”:

tag manager - choosing a tag type for tracking mail to link clicks - choose universal analytics

Select Google Analytics. Then, with “Tag Type” set universal Analytics and specify your tracking ID.

You will then need to configure the tag by first setting the “Track Type” to “Event”, and then by defining the event category, action and label as shown below. The {{page path}} variable will enable you to gain information in relation to on which page of the website the mailto link click occurred.

If you wouldn’t like your link click to affect your bounce rate metric, you can set the “Non-Interaction Hit” to “True”. However, as the link click is an interaction, I prefer to leave this as “False”:

tag manager - tag configuration for measuring mailto link clicks as event in analytics

Once you have clicked continue, you will then need to select a firing trigger. This has of course been previously created and so you will need to select it from your “Existing Click Trigger” list:

tag manager - select your mailto link click trigger

Click save to create the tag. All being well, the trigger will now fire each time someone clicks on a mailto link:

tag manager - mail to tracking tag and trigger configurated

Tag Manager allows you to preview and debug your tags to test that triggers are firing correctly:

tag manager preview option

Open up preview and debug mode. Visit your website and click on a mailto link. You should then see that upon this event the tag fires your Mailto Link Event:

Tag Manager - preview and debug mode to check mailto link clicks are working

As an additional check I always like to view the event within the real-time area of Google Analytics:

double check in real time

The final step is to set up a goal within Google Analytics to track the mailto link click event. To do this, create a new custom goal up and select “Event” as the goal type:

mailto event goal

Ensure that the event conditions are correct as per your previously defined event within Tag Manager – they have to be exactly the same as what you put in there (all you need is category and action). Once saved, this will ensure that any events are also tracked and recorded as goals for your mailto link clicks within Google Analytics:

mailto event goal

Google Tag Manager is a great tool that removes the reliance on development resources to track interactions across a website. It provides great flexibility to those with little coding or technical knowledge who are looking to track website performance.

In relation to mailto links, all websites using them should follow this guide and start tracking visitor interactions. This is particularly important if this is the only way visitors have of getting in touch via written message!

I’d also strongly recommend that you look to implement embedded contact forms within your website to capture data in relation to enquiries, leads, quotes etc. This will provide a much more accurate picture of website performance when hooked up to Google Analytics.

Bonus: Track Telephone Links Clicks the same way

You can track phone number clicks in exactly the same way – just change the click URL to match the on on your site:

tag manager - how to track telephone link clicks

 

If you have any difficulty in setting up the tracking detailed in this post, then please don’t hesitate to leave a comment below and our SEO experts will get back to you.

Leave a Reply

Your email address will not be published. Required fields are marked *