-
Notifications
You must be signed in to change notification settings - Fork 62
feat: Implements Global Session ID #1217
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: Implements Global Session ID #1217
Conversation
src/utils/sdk.js
Outdated
if (__MESSAGES__.__TARGET__ === 'SDK') { | ||
const globalSessionID = getSDKGlobalSessionID(); | ||
|
||
if (globalSessionID) { | ||
return globalSessionID; | ||
} else { | ||
const globalSessionIDValue = createBelterID(); | ||
setSDKGlobalSessionID(globalSessionIDValue); | ||
|
||
return globalSessionIDValue; | ||
} | ||
} else { | ||
return undefined; | ||
} |
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.
we can update 171 to use a let
so we can re-assign the variable to prevent creating another variable. something like this:
let globalSessionID = getSDKGlobalSessionID();
if (!globalSessionID) {
globalSessionID = createBelterID();
setSDKGlobalSessionID(globalSessionID);
}
return globalSessionID;
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.
Thanks Rene, Ive made the update in latest commit.
src/utils/sdk.js
Outdated
|
||
return globalSessionID; | ||
} else { | ||
return undefined; |
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.
I mentioned we could just leave this as undefined
. Let's actually just use the same fallback as getSessionID
, so getStorage().getSessionID()
. They can be the same value that's fine.
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.
Thanks Nate, Ive made the update.
Description
Screenshots
Passes global_session_id to logger for tracking

Testing instructions
Validated sdk via cdn stage bundle as well as downstream internal applications to accept the event for tracking purposes