APIs & Integrations

mgoswick
Contributeur

mailto and tel links not tracked in emails

Résolue

Both mailto and tel links work when placing into emails, being delivered as a clickable link to the recipient; however, when querying the events API, or looking within the analytics of the email send, clicks on those links are not tracked. It seems they are not properly converted into trackable links before sending, requiring additional tracking tools to capture those analytic clicks. Is this intentional, and are there any ways to change it?

1 Solution acceptée
mgoswick
Solution
Contributeur

mailto and tel links not tracked in emails

Résolue

@dennisedson @rvatalaro 

Reporting back on this for a workaround. Because of the nature of the mailto: and tel: links, HubSpot does not automatically create the tracking url like normal, as UTMs cannot be appended to these links and have them work. 

 

Instead, you can do a workaround using a landing page and javascript. You can create a blank landing page that you will direct all traffic to for any tel or mailto link (I used sub.domain.com/click-to-call/ or sub.domain.com/click-to-email/). You then pass the email or phone via a query parameter, such as phone=5558880011. Finally, you can place the script below on your page. It will parse the URL for the parameter, then open a new page with the parameter. 

 

<script>
  function getParameterByName(name, url = window.location.href) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
  };
  var salesPhoneNumber = getParameterByName('phone');
  window.open("tel:" + salesPhoneNumber,"_self");
</script>

 

The obvious downside of this method is that it 1) still leaves the original page open, forcing the user to manually close it after the tel or mail link triggers 2) while it works for now, there seems to be a move towards depreciating this type of functionality in javascript, so it may not work forever.

 

Hope this helps someone else. It would be nice if HubSpot created an official way to do this (maybe by handling the page capture automatically and providing a redirect), but until then.

Voir la solution dans l'envoi d'origine

6 Réponses
mgoswick
Solution
Contributeur

mailto and tel links not tracked in emails

Résolue

@dennisedson @rvatalaro 

Reporting back on this for a workaround. Because of the nature of the mailto: and tel: links, HubSpot does not automatically create the tracking url like normal, as UTMs cannot be appended to these links and have them work. 

 

Instead, you can do a workaround using a landing page and javascript. You can create a blank landing page that you will direct all traffic to for any tel or mailto link (I used sub.domain.com/click-to-call/ or sub.domain.com/click-to-email/). You then pass the email or phone via a query parameter, such as phone=5558880011. Finally, you can place the script below on your page. It will parse the URL for the parameter, then open a new page with the parameter. 

 

<script>
  function getParameterByName(name, url = window.location.href) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
  };
  var salesPhoneNumber = getParameterByName('phone');
  window.open("tel:" + salesPhoneNumber,"_self");
</script>

 

The obvious downside of this method is that it 1) still leaves the original page open, forcing the user to manually close it after the tel or mail link triggers 2) while it works for now, there seems to be a move towards depreciating this type of functionality in javascript, so it may not work forever.

 

Hope this helps someone else. It would be nice if HubSpot created an official way to do this (maybe by handling the page capture automatically and providing a redirect), but until then.

Mike_Eastwood
Conseiller clé | Partenaire solutions Gold
Conseiller clé | Partenaire solutions Gold

mailto and tel links not tracked in emails

Résolue

Hi @mgoswick 

 

Yes, I found the same issue with "mailto" links.

 

I haven't tried making a Call To Action (CTA) to see if that works... that's on my list to try.

 

Cheers

Mike

mgoswick
Contributeur

mailto and tel links not tracked in emails

Résolue

I had not thought about using CTAs, and on test, it does seem to work. However, we are populating the phone numbers and emails of sales team members, so we would have to create CTAs or smart variants for each member to populate phone numbers and email addresses that are trackable in emails. Further, CTAs can't be dropped inline with text in the drag and drop email editor, so utilizing CTAs wouldn't work without adjusting the overall design (and even then its hit or miss).

 

Also worth noting that the button module in the drag and drop editor also does create trackable links for email addresses and has no option for phone links.

dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

mailto and tel links not tracked in emails

Résolue

I will ask around about this and report back if I have any more details 😀

0 Votes
rvatalaro
Participant

mailto and tel links not tracked in emails

Résolue

Is there any new information about this? 

0 Votes
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

mailto and tel links not tracked in emails

Résolue

Hey @mgoswick ,

I will have to test this and see if I experience the same issue

@Mike_Eastwood , have you had this experience?

0 Votes