I want to create a way to track how many times a user has visited a page.
Problem is that i want to only increase the cookie visit count if more than 30 minutes have past since the last visit.
How could i do this?
Right now this is what i have to set and get cookie:
getCookie('xVisitors');
setCookie('xVisitors', 1, 120);
function setCookie(b, c, e) {
var i = "";
e > 0 && (i = new Date, i.setTime(i.getTime() + e * 6E4), i = "; expires=" + i.toGMTString());
e = "";
document.cookie = b + "=" + c + i + "; path=/;" + e
};
function getCookie(b) {
for (var c = document.cookie.split(";"), e = 0; e < c.length; e++) {
for (var i = c[e]; i.charAt(0) == " ";) i = i.substring(1, i.length);
if (i.indexOf(b) == 0) return i.substring(b.length + 1, i.length);
}
return "";
}