Have you ever found yourself in a situation where you needed a Click To Call feature in your landing pages or popups?

For example, perhaps you want to use a Click To Call button but you have different phone numbers for different locations, and need DTR (Dynamic Text Replacement) functionality to work within a link (when the link points to changes based on the value in the URL parameter).

 

Up until this point, DTR (in Unbounce) couldn’t change button or text link URLs. We're happy to announce that those days are over! We've added DTR to the button and used jQuery to change the link text to include the URL parameter.

You can see this in action (built in Unbounce) here:

 

 

 

 

 

 

 

 

 

 

 

 

https://success.unbounce.com/phone-dtr/?phone=555-5555

To achieve this functionality, follow the instructions below… 

How to do it ⚙️

 

Enter the following code snippet into your your button’s Javascript tab, below the body end tag, and follow along with the commented code, and BOOM! You’ve got yourself a Dynamic Click To Call button!

<script> function getParameterByName(name) { var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); } //replace 'phone' with your DTR's URL parameter var phonenumber = getParameterByName('phone'); //replace "#lp-pom-button-9" with your button id $( "#lp-pom-button-9" ).attr("href", "clkn/tel/"+ phonenumber); </script> 

GROWTHLIST Community

Join a community of growth makers helping each other to accelerate their growth