Introduction:
In this guide we will show you how to display count down across all the nodes in your DT. And then additionally redirect out of LeadsHook when the countdown completes.
Step-by-Step Instructions:
Step 1. Simply copy paste the below code to the HTML section in your appearance settings.
Here’s the code:
<div class="holder">
<div id="minutesTxt"><br />
Minutes</div>
<div id="secondsTxt"><br />
Seconds</div>
<br />
</div>
Step 2. Copy paste the below code to the decision tree specific script
<style type="text/css">#minutesTxt, #secondsTxt{
display: inline-block;
background-color: #FF1493;
border-radius: 10px;
color: white;
width: auto;
min-width:70px;
margin-left: 10px;
padding: 14px;
}
.holder
{
width: 100%;
margin: auto;
text-align: center;
}
#minutesTxt, #secondsTxt{
font-size: 27px;}
</style>
<script>
// Set the date we're counting down to
var MinutesLater = new Date(); //Now
MinutesLater.setMinutes(MinutesLater.getMinutes() + 20); //Add 20 minutes time from now ( Adjust minutes here )
var countDownDate = MinutesLater.getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Format the time with two digits per hour/mins/sec's
minutesString = minutes.toString().padStart(2, '0') + '<br/>Minutes';
secondsString = seconds.toString().padStart(2, '0') + '<br/>Seconds';
// Print the current time so far
document.getElementById("minutesTxt").innerHTML = minutesString;
document.getElementById("secondsTxt").innerHTML = secondsString;
// Check if countdown is complete & redirect
if (distance < 0) {
clearInterval(x);
window.top.location='https://disney.com';
}
}, 1000);
</script>
You can see a working demo here:
https://test2.leadshook.io/survey/k8Yl4Qz9N83kXAH2MEEojEOgnFtshfVPTblPllKi
You can download a copy here: