I am building a page for our Virtual Assistant’s company - What I am looking for is at the bottom of the page there to be a live timer counting how long the visitor has been on the page. The purpose of this is for a meaningful call to action.
You’ve spent (Live time count) on this page
A virtual assistant should have done that for you
The implemented this code to the pages body code:
<script>
var sec = 0;
function pad ( val ) { return val > 9 ? val : "0" + val; }
setInterval( function(){
document.getElementById("seconds").innerHTML=pad(++sec%60);
document.getElementById("minutes").innerHTML=pad(parseInt(sec/60,10));
}, 1000);
</script>
And then creating an embeded element with this:
<span id="minutes"></span> Min :<span id="seconds"></span> Sec