-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Adding a method pbjs.getUserIds to share userIds in Prebid to external codes #3889
Conversation
… codes - Need an API to share the UserIds retrieved by Prebid with external codes - Use casse: UserIds can be passed to Wrappers like A9/EB - Added pbjs.getUserIds method - Moved the cide that initalizes all sub-modules and calls passbacks into a separate function - Moved code to combine submodule ids in an object into a separate function
Hello @idettman , |
Example: |
@pm-harshad-mane - we're going to need a docs update for new external API call. Care to take a cut at a PR for http://prebid.org/dev-docs/publisher-api-reference.html ? |
Sure @bretg , I will add the documentation PR as well. |
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.
Waiting for @jaiminpanchal27 to take a look before I approve
modules/userId.js
Outdated
@@ -414,6 +443,10 @@ export function init(config) { | |||
updateSubmodules(); | |||
} | |||
}) | |||
|
|||
// exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes. | |||
let theGlobal = getGlobal(); |
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.
@jaiminpanchal27 Can you review this use of getGlobal?
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.
@idettman this looks good. Use case here is valid and user id being a core module we can allow usage of global.
Another approach to not use global here was to import getUserIds function in prebid.js and use their but then it will always import user id module.
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.
Thank you @jaiminpanchal27 👍
Hello @jaiminpanchal27 , |
Hello @jaiminpanchal27 and @idettman , |
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.
@pm-harshad-mane Left one comment
modules/userId.js
Outdated
* This function will be exposed in global-name-space so that userIds stored by Prebid UserId module can be used by external codes as well. | ||
* Simple use case will be passing these UserIds to A9 wrapper solution | ||
*/ | ||
function getUserIds() { |
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.
@pm-harshad-mane Should this function not have a callback function as argument which will be called when user id's are ready. Id systems make async calls to get user ids. This function may return empty object or 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.
Hello @jaiminpanchal27 ,
my expectation from the API is to return whatever data is available at the moment.
It will be a good feature to have a call-back on getting all ids, but for now, it is not a requirement. Also, as userId module is caching the data, maybe on the second iteration of execution the new API will return all ids so it is sufficient for now.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Small changes to line 204 and line 449, the rest looks good
This comment has been minimized.
This comment has been minimized.
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.
LGTM
Thank you @idettman and @jaiminpanchal27 !! |
…l codes (prebid#3889) * Adding a mthod pbjs.getUserIds to share userIds in Prebid to external codes - Need an API to share the UserIds retrieved by Prebid with external codes - Use casse: UserIds can be passed to Wrappers like A9/EB - Added pbjs.getUserIds method - Moved the cide that initalizes all sub-modules and calls passbacks into a separate function - Moved code to combine submodule ids in an object into a separate function * implemented code suggestion chnages * fixed eslint issue
…l codes (prebid#3889) * Adding a mthod pbjs.getUserIds to share userIds in Prebid to external codes - Need an API to share the UserIds retrieved by Prebid with external codes - Use casse: UserIds can be passed to Wrappers like A9/EB - Added pbjs.getUserIds method - Moved the cide that initalizes all sub-modules and calls passbacks into a separate function - Moved code to combine submodule ids in an object into a separate function * implemented code suggestion chnages * fixed eslint issue
…l codes (prebid#3889) * Adding a mthod pbjs.getUserIds to share userIds in Prebid to external codes - Need an API to share the UserIds retrieved by Prebid with external codes - Use casse: UserIds can be passed to Wrappers like A9/EB - Added pbjs.getUserIds method - Moved the cide that initalizes all sub-modules and calls passbacks into a separate function - Moved code to combine submodule ids in an object into a separate function * implemented code suggestion chnages * fixed eslint issue
…l codes (prebid#3889) * Adding a mthod pbjs.getUserIds to share userIds in Prebid to external codes - Need an API to share the UserIds retrieved by Prebid with external codes - Use casse: UserIds can be passed to Wrappers like A9/EB - Added pbjs.getUserIds method - Moved the cide that initalizes all sub-modules and calls passbacks into a separate function - Moved code to combine submodule ids in an object into a separate function * implemented code suggestion chnages * fixed eslint issue
Type of change
Description of change
Adding a method pbjs.getUserIds to share userIds in Prebid to external codes.