Alexodiy,
document.addEventListener("DOMContentLoaded", function() {
var num = localStorage.getItem("num") || 0,
today = sessionStorage.getItem("today");
if(today === "yes") return;
sessionStorage.setItem("today", "yes");
num = +num + 1;
localStorage.setItem("num", ""+num);
if(num % 3 === 0 ) alert("3");
});