mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-04 11:10:04 -04:00
Fix the visit tracking logic
This commit is contained in:
parent
8b37dadec7
commit
62444b9a13
1 changed files with 8 additions and 4 deletions
|
@ -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…
Add table
Reference in a new issue