简体   繁体   中英

Add a redirect to a Tel link

we're using a tel link (eg. <a href="tel:+1-303-499-7111">+1 (303) 499-7111</a> ) so people can call us from their device. How can we also have the link redirect to another page with a tracking pixel so that we can measure the phone call as a conversion?

If you having the pixel as an img then you do tracking as follows:

<a href="tel:+1-303-499-7111" onclick=trackPixel()>+1 (303) 499-7111</a>
function trackPixel() {
  const pixelURL = `https://static.pixel.com/ase/25565/1553/aa.js`;
  new Image().src = pixelURL;
}

This will trigger the URL when the user clicks the phone number.

If you want to do 2 redirect at a time you need to do some script code

<a onClick="makeCall()">+1234567890</a>

and the script is

function makeCall(){
  window.open('_link is here_', '_blank'); 
  window.open('tel:+1303499-7111', '_parent'); 
}

It actually works fine with you use tel:// All you have to do is create a call now link that goes to your script to track the call and then redirect to the tel:// link

Here are the sample headers from my test session.

Connection: Keep-Alive
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Thu, 21 Nov 2019 20:24:08 GMT
Keep-Alive: timeout=5, max=100
Location: tel://5551212
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40
X-Powered-By: PHP/5.6.40

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM