Time On Site

Show the user how long they have spent on your site in total.

About This Script

Add this to your site by copying and pasting the code (below) to where you would like it to appear on your page. You need to add this to every page you would like to count towards the total time a user spends on your site.

Demo

Code

<!-- jQuery is required if you're not already using it --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> <script> (function(){ var previousCookie = $.cookie('timeOnSite'); var timeOnSite = previousCookie ? parseInt(previousCookie) : 0; function incremementTimeOnSite() { ++timeOnSite; showTimeOnSite(); $.cookie('timeOnSite', timeOnSite); } function showTimeOnSite() { var hours = (timeOnSite / 3600) % 24; var minutes = (timeOnSite / 60) % 60; var seconds = timeOnSite % 60; var str = ''; if (hours >= 1) { str += Math.floor(hours) + ' hour' + s(hours) + ' '; } if (minutes >= 1) { str += Math.floor(minutes) + ' minute' + s(minutes) + ' '; } str += seconds + ' second' + s(seconds) + ' '; $('.timeOnSite').html("You've been on our site for " + str); } function s(num) { if (num >= 2) { return 's'; } return ''; } setInterval(incremementTimeOnSite, 1000); })(); </script> <noscript>Time on site provided by <a href="http://www.top-site-list.com">Top Site List Planet</a></noscript> <span class="timeOnSite"></span>
More scripts

Do you want to expose your site to millions?
Do you want to be ranked higher in Google?
Do you want to be known as the best site in your niche?

Then look no further. Add your site in 3 simple steps. Sign up, Add your site and Start receiving votes! It only takes 10 seconds!

Sign Up to Top Site List Planet Now!

Login with one of these social networks...

Sign in with FacebookSign in with TwitterSign in with Google+Sign in with Yahoo!Sign in with LinkedIn

or create an account with your email...

Login To An Existing Account