-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat: fetch anonymous id by cookie name provided in load option #1625
feat: fetch anonymous id by cookie name provided in load option #1625
Conversation
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe recent updates introduce the capability to set an anonymous ID for users from an external source via cookies, enhancing the flexibility and customization of user tracking in analytics. This is achieved through a new field in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
size-limit report 📦
|
…nalanonymousidcookiename
…cookiename' of https://github.com/rudderlabs/rudder-sdk-js into feature/sdk-1298-add-new-loadoption-externalanonymousidcookiename
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1625 +/- ##
===========================================
+ Coverage 54.68% 54.70% +0.01%
===========================================
Files 581 581
Lines 17731 17740 +9
Branches 3269 3275 +6
===========================================
+ Hits 9696 9704 +8
- Misses 6568 6569 +1
Partials 1467 1467 ☔ View full report in Codecov by Sentry. |
@coderabbitai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (3)
- packages/analytics-js-common/src/types/LoadOptions.ts (1 hunks)
- packages/analytics-js/tests/components/userSessionManager/UserSessionManager.test.ts (2 hunks)
- packages/analytics-js/src/components/userSessionManager/UserSessionManager.ts (3 hunks)
Additional comments: 4
packages/analytics-js-common/src/types/LoadOptions.ts (1)
- 149-149: The addition of
externalAnonymousIdCookieName
toLoadOptions
is aligned with the PR's objectives. However, consider adding documentation/comments explaining the purpose and usage of this new field to help developers understand its function within the SDK.packages/analytics-js/src/components/userSessionManager/UserSessionManager.ts (3)
- 8-8: The addition of
isDefinedAndNotNull
enhances type checking. Ensure it's used consistently across the SDK for similar checks.- 97-107: The logic to fetch
externalAnonymousId
from a cookie ifexternalAnonymousIdCookieName
is provided and valid is correctly implemented. However, ensure that the fallback to existing logic when the cookie is not present or invalid is thoroughly tested.- 366-372: The
getExternalAnonymousIdByCookieName
method is a crucial part of the new feature. It's implemented to fetch theanonymousId
from a specified cookie. Ensure that edge cases, such as cookies being disabled or inaccessible due to browser policies, are handled gracefully.
packages/analytics-js/__tests__/components/userSessionManager/UserSessionManager.test.ts
Show resolved
Hide resolved
packages/analytics-js/__tests__/components/userSessionManager/UserSessionManager.test.ts
Show resolved
Hide resolved
…nalanonymousidcookiename
Quality Gate passedIssues Measures |
PR Description
Introduced a load option to fetch anonymousId cookie set by external source and set it as rl_anonymousId.
Linear task (optional)
https://linear.app/rudderstack/issue/SDK-1298/add-new-loadoption-externalanonymousidcookiename
Cross Browser Tests
Please confirm you have tested for the following browsers:
Sanity Suite
Security
Summary by CodeRabbit
anonymousId
from an external source via cookies, enhancing user session management.