Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (@jitsu/js): Preserve anonymous ID as a string and avoid parsing #1154

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

dmeremyanin
Copy link
Contributor

This PR addresses an issue where the __anon_id cookie was being parsed, potentially altering its value. The __anon_id must always be returned as a string to preserve its exact value.

Issue Example

Before the fix, parsing the cookie value 1724633695283.638279 with JSON.parse() would convert it to a JS number, which results in precision loss. In this case, the number would become 1724633695283.6382 due to the way JavaScript represents floating-point numbers.

After the fix, the __anon_id value is returned as a string without any change, preserving the exact value.

@dmeremyanin dmeremyanin force-pushed the jitsu-js-anonymous-id-fix branch from 82b21d3 to 6aca3e4 Compare December 14, 2024 09:57
@absorbb absorbb merged commit 61c168e into jitsucom:newjitsu Dec 17, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants