[PULSE-51] Visitor ID storage: optional localStorage for cross-tab unique visitors #21

Merged
uz1mani merged 17 commits from staging into main 2026-02-11 15:14:13 +00:00
3 changed files with 85 additions and 20 deletions
Showing only changes of commit 10df76454a - Show all commits

View File

@@ -172,8 +172,7 @@
}
} catch (e3) {}
}
// * Best-effort only: another tab could write before setItem; without locks perfect sync is not achievable
cachedSessionId = generateId();
// * Best-effort only: another tab could write between here and setItem; without locks perfect sync is not achievable
localStorage.setItem(key, JSON.stringify({ id: cachedSessionId, created: Date.now() }));
} catch (e) {
cachedSessionId = generateId();