You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Web] getExistingAnonymousId does not decode JSON-stringified ajs_anonymous_id from localStorage #196
When analytics.js (the Segment JavaScript SDK) writes ajs_anonymous_id to localStorage, it uses JSON.stringify(), which wraps the UUID in surrounding double-quote characters. The Flutter SDK's getExistingAnonymousId() in packages/core/lib/utils/store/web.dart reads this value via localStorage.getItem() but does not decode it, so the quotes become part of the anonymous ID string.
This means any Flutter web app running on a domain where analytics.js has previously set ajs_anonymous_id will pick up a corrupted anonymous ID (e.g. "d039d945-..." instead of d039d945-...), causing identity mismatches between the JS and Flutter SDKs.
Expected behavior
anonymousId should be a clean UUID:
d039d945-572c-4148-b072-2b54ef52102a
Actual behavior
anonymousId includes surrounding quotes, which get double-escaped when serialized to analytics-flutter-userInfo.json:
json.decode the raw localStorage value in getExistingAnonymousId() before returning it, with a try/catch fallback for values that are already plain strings.
Activity
fix(web): decode JSON-stringified ajs_anonymous_id from localStorage (s…
fix(web): decode JSON-stringified ajs_anonymous_id from localStorage (s…
fix(web): decode JSON-stringified ajs_anonymous_id from localStorage (s…
fix(web): decode JSON-stringified ajs_anonymous_id from localStorage (#…