Skip to content

Conversation

jonacox-paypal
Copy link
Contributor

Description

  • Adds a global_session_id for correlating events across different use cases
  • getOrCreateSessionID uses belter for generating uid
  • Not applicable in standalone use case

Screenshots

Passes global_session_id to logger for tracking
image

Testing instructions

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

src/utils/sdk.js Outdated
Comment on lines 170 to 183
if (__MESSAGES__.__TARGET__ === 'SDK') {
const globalSessionID = getSDKGlobalSessionID();

if (globalSessionID) {
return globalSessionID;
} else {
const globalSessionIDValue = createBelterID();
setSDKGlobalSessionID(globalSessionIDValue);

return globalSessionIDValue;
}
} else {
return undefined;
}
Copy link
Contributor

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;

Copy link
Contributor Author

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;
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@JordanClemons JordanClemons merged commit af2d6e1 into paypal:develop Sep 2, 2025
48 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.

4 participants