mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 11:33:06 +08:00
Fix the visit tracking logic
This commit is contained in:
parent
8b37dadec7
commit
62444b9a13
|
@ -73,13 +73,17 @@ export default {
|
|||
|
||||
// Record a visit
|
||||
const nowVisit = new Date().getTime();
|
||||
const lastVisit = keyValueStore.getInt('anon-last-visit', nowVisit);
|
||||
if (nowVisit - lastVisit > ONE_DAY) {
|
||||
// more than a day
|
||||
const lastVisit = keyValueStore.getInt('anon-last-visit', 0);
|
||||
if (!lastVisit) {
|
||||
// First visit
|
||||
keyValueStore.setItem('anon-visit-count', 1);
|
||||
keyValueStore.setItem('anon-last-visit', nowVisit);
|
||||
} else if (nowVisit - lastVisit > ONE_DAY) {
|
||||
// More than a day
|
||||
const visitCount = keyValueStore.getInt('anon-visit-count', 1);
|
||||
keyValueStore.setItem('anon-visit-count', visitCount + 1);
|
||||
keyValueStore.setItem('anon-last-visit', nowVisit);
|
||||
}
|
||||
keyValueStore.setItem('anon-last-visit', nowVisit);
|
||||
|
||||
checkSignupCtaRequirements();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user