Your complete guide to tracking email and phone clicks in Google Analytics with Google Tag Manager

By Emma Barnes
6th September 2021

Tracking clicks for email and phone enquiries is setup a little differently on Universal Analytics compared to Google Analytics 4, in the below guide, I’m going to take you through how to set this up for both, allowing you to accurately measure this key success metric.

Setting this up using Google Tag Manager means that you don’t require developer support, and means that you can leverage it to capture data for other platforms (e.g. Google Ads, Facebook) keeping all of your tracking and data in one place.

There are three parts to this guide; Google Tag Manager (GTM) configuration, Universal Analytics (GA3) Goal Configuration, and Google Analytics 4 (GA4) Conversion and Custom Dimension Configuration.

Please note; this tracks when a user has clicked on a telephone or email link with the intent to get in touch, not whether the user actually called or sent an email.

 

Part 1: Enquiry Tracking: GTM Configuration

There are two methods to use to implement this tracking with Google Tag Manager. Method one includes downloading a Google Tag Manager receipt that Wolfenden has created and upload it to your own GTM account. Method 2 is a step-by-step guide on creating this for yourself.

 

Method 1 – Google Tag Manager Recipe Upload

Download the Google Tag Manager Recipe below:

Download GTM Import

In Google Tag Manager, go to Admin > Import Container and upload your container file. Choose Merge – there should be no conflicts.

There are two new tags that need amending: amend your GA3 Google Analytics settings (either using the Google Analytics settings variable or in the Tracking ID override) or GA4 as appropriate.

Go to Tags.

In the tag called GA3 – Event – Enquiry, the Google Analytics Settings variable will be empty. Add your Google Analytics settings variable to match all your other GA3 tags. You need to add this variable in order to send data to Google Analytics.

In the tag called GA4 – Event – Enquiry, amend the Configuration Tag and Measurement ID to match your other Google Analytics 4 tags.

If you don’t use Universal Analytics or Google Analytics 4, delete the relevant tag.

Test the new tags using the preview mode and publish your container (buttons in the top right).

 

Method 2 – Step-by-step guide

If you’re interested in creating this by yourself or customising it you can follow the steps below.

 

Step 1 – Enable Click URL as a Built-In Variable

Go to Variables and click “Configure” next to Built-In Variables.

Scroll down to “Clicks” and tick the checkbox for . This will be used to determine what URL was clicked on and can be used in other variables to determine if it’s a telephone or email URL.

Click URL is now enabled as a variable to be used.

 

Step 2 – RegEx Table Variable to extract the e-mail or telephone number

Part of what we want to do is extract the email address or telephone number clicked on and send this data to Google Analytics. This can be done by using JavaScript to read and amend the URL clicked on.

Go to Variables and create a new variable (variable type: RegEx Table)

Input Variable: {{Click URL}}

RegEx Table: As below

Pattern Output
^(mailto|tel):([^\?]+)(\?.*|$) $2

This reads the click URL to determine whether it’s an email or telephone click. It then splits out the URL into three parts: the identifier, the email or telephone number, and additional information.

The table then extracts the second part using the $2 RegEx extraction to pass on the relevant information as a variable.

Set Default Value: Other

Format Value: Change Case to: Lowercase

Save your variable as RegEx Table – Click URL – Extract Email or Telephone.

Optional: If, for example, your telephone numbers are inconsistent across the site (e.g. 07755555555 vs 077 5555 5555 vs 077-5555-5555) you may consider using a custom JavaScript variable to tidy up the number collected using the trim or replace methods.

Step 3 – RegEx Table to categorise enquiry type

Go to Variables and create a new variable (variable type: RegEx Table) with the following settings:

Input Variable: {{Click URL}}

RegEx Table: As below

Pattern Output
^mailto:.*$ Email
^tel:.*$ Telephone

Set Default Value: Other

This searches for the URL that was clicked on and puts it into a category based on whether it’s an email click or a telephone click.

Save your variable as RegEx Table – Enquiry Type

Step 4 – Enquiry click trigger

Go to Triggers and create your trigger for enquiry clicks.

Trigger Type: Click – Just Links

This trigger fires on Some Link Clicks RegEx Table – Enquiry Type does not equal Other

Save this trigger.

Optional: If you need to use Email or Telephone click separately, create 2 separate triggers for email and telephone by changing the condition to RegEx Table – Enquiry Type equals Telephone or Email as appropriate. These have been added to the GTM recipe above for usage if required.

Step 5 – Universal Analytics Event Tag

Skip this step if you don’t use Universal Analytics (GA3).

Go to Tags and create a new tag (tag type: Google Analytics: Universal Analytics)

Configure the event as below

Track Type: Event

Category: Enquiry

Action: {{RegEx Table – Enquiry Type}}

Label: {{RegEx Table – Click URL – Extract Email or Telephone}}

Use the same Google Analytics settings as any other Universal Analytics tag.

Add both new triggers to this tag and save the new tag.

Step 6 –Google Analytics 4 Event Tag

Skip this step if you don’t use Google Analytics 4 (GA4).

Go to Tags and create a new tag (tag type: Google Analytics: GA4 Event)

Configure the event as below

Use the same Configuration Tag and Measurement ID as any other GA4 tags.

Event Name: enquiry

Event Parameters: as below

Parameter Name Value
enquiry_type {{RegEx Table – Enquiry Type}}
enquiry_contact {{RegEx Table – Click URL – Extract Email or Telephone}}

 

 

Note: GA4 only allows 50 custom parameters, but 500 event names. If you would prefer to keep a custom parameter slot free, this event could be broken into two events by removing the “enquiry_type” custom parameter, and changing the event name to be “enquiry_email” or “enquiry_telephone” and ensuring they are giving the corresponding triggers. This allows for these events to still be measured but without the additional parameter being used.

Add both new triggers to this tag and save the new tag.

Step 7 – Preview and Publish container

This can be accessed using the “Preview” and “Submit” buttons in the top right of your Google Tag Manager container. You should test this by clicking email addresses and telephone numbers on your site, and ensuring the desired result comes back. As well as this – try clicking other links to ensure it does not over fire.

 

Part 2: Enquiry Tracking: Universal Analytics Goal Configuration

If you do not use Universal Analytics (GA3) or do not want this information tracked as a goal, you can skip this part. The data will be captured as an event and you will be able to view it in the Behaviour > Events reports without this step.

To capture enquiries as a goal in GA3, go to Admin (the cog at the bottom of the menu) and then Goals and +New Goal.

You can create a goal to capture all enquiries or two goals: one for each type of enquiry.

Select Goal Set-Up: Custom. Click continue and customise the goal as below.

Name: Enquiry (or E-mail/Telephone Enquiry)

Type: Event

Click continue and input the Event Conditions:

Category Equal to Enquiry

This is enough if you want to track both types of enquiry together in one goal. If you want to track both types separately, add a second condition that specifies the Action equal to Email or Telephone as required.

Save your goal, it will now be tracking.

 

Part 3: Enquiry Tracking: Google Analytics 4 Conversion and Custom Dimension Configuration

If you do not use Google Analytics 4 (GA4), this part can be skipped.

With the tag as it is, the event will be captured in the Engagement > Events report, but the Custom Dimensions (Enquiry Type, Screen and Details) are not being recorded.

Go to Configure > Custom definitions (left-hand menu) and select Custom dimensions. Click Create custom dimensions to add the three below

Dimension Name Scope Description Event parameter
Enquiry Type Event Whether the enquiry is an email click or a telephone click enquiry_type
Enquiry Contact Event The contact information about the enquiry (e.g. email address or phone number) enquiry_contace

Once this is saved, the additional information will be recorded.

To define an event as a conversion, go to Configure > Conversions and select Conversion Events. If the event already exists you can use the Mark as conversion checkbox to ensure it is tracked as a conversion. If the event doesn’t exist yet, click New conversion event and add Enquiry as a new conversion event.

All done!

With this, you are now collecting valuable data about e-mail and telephone clicks in Google Analytics. Data may take up to 24-hours to be displayed.

If you have any questions about this or any other Google Analytics and Tag Manager tracking, please get in touch for some free advice.

Latest Insights From The Team.

Explore our team’s latest thoughts and actionable advice from our blog to support your digital marketing strategies.

The Trends
That Matter.

We’ve delved into the organic performance of brands within the Travel & Leisure Retail sector, revealing the growing trends companies in this space should be taking note of to help gain more organic market share. Sign up to receive this and future reports for free below.

    Read our Privacy Policy here for information on how we use and store your data.