Count the number of visits
I'm trying to use this snippet in a profile script to count the the number of visits:
if(user.sessionId!=user.getLocal('lastSessionId')) {
user.setLocal('lastSessionId', user.sessionId);
return (user.get('visitCount') || 0) + 1;
}
For example:
* in the first visits the value expected is "1"
* in the second is "2"
* ...
Even if I wait 30m or more for the session to expire and I go back to a page on the site, the value I see is always 1. Can you help me figure out if there is an error?