-
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
CriteoId User Module #4287
CriteoId User Module #4287
Conversation
cf3db2b
to
d4fafb5
Compare
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.
@Swiiip Please see inline comments.
Also please submit a PR to the docs repo to list Criteo ID system here http://prebid.org/dev-docs/modules/userId.html. Thank you for contributing
const pastDateString = new Date(0).toString(); | ||
const expirationString = new Date(utils.timestamp() + cookiesMaxAge).toString(); | ||
|
||
function areCookiesWriteable() { |
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.
Can you use cookiesAreEnabled
from utils https://github.com/prebid/Prebid.js/blob/master/src/utils.js#L908
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.
cookiesAreEnabled function uses the window.navigator.cookieEnabled flag which returns true on Safari even on domains considered as trackers by ITP, which we would like to avoid. That's why we only rely on the read/write check.
return canWrite; | ||
} | ||
|
||
function extractProtocolHost (url, returnOnlyHost = false) { |
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.
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.
Done 👍, I kept the formatting part in the module, but the parsing part uses url.js function.
modules/criteoIdSystem.js
Outdated
* @param {SubmoduleParams} [configParams] | ||
* @returns {function(callback:function)} | ||
*/ | ||
getId(configParams) { |
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 tried this on hello_world page and it does not work. Here is the fiddle https://jsfiddle.net/t2c3nfq4/
Here jsdoc says it returns function but I see an object on line 134. On first call when there is nothing in localStorage/cookies, getId will return {'criteoId: undefined'}
. User id module calls submodule.getId() from here https://github.com/prebid/Prebid.js/blob/master/modules/userId/index.js#L391 and here https://github.com/prebid/Prebid.js/blob/master/modules/userId/index.js#L418. Your response is not satisfying none of the scenarios.
Can you share a working test page ? More details here http://prebid.org/dev-docs/modules/userId.html
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 updated the code from getId() and decode(id).
getId() returns an object {id: xxx}
where xxx can either be an object {criteoId: <criteoId>}
or undefined
decode(id) returns the id as-is
The jsfiddler should work now.
The updated doc for the Criteo ID module is available here: prebid/prebid.github.io#1575 |
@Swiiip Everything looks good. Just one more missing part. And also pull master from upstream to resolve this conflict. Thanks |
776e0fd
to
ca69371
Compare
Hello @Swiiip , CI job is failing, can you merge the upstream/master in your branch and try again? this may pass the CI job. |
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
Changes: - Use of url parsing function from url lib - Update the return type of getId() - Update the jsdoc to reflect the real return types
ca69371
to
9745fa2
Compare
Hello @Swiiip , Few questions for you,
@jaiminpanchal27, @jsnellbaker |
Hello @pm-harshad-mane, Thank you for your interest in this module.
|
Add CriteoId User Module
Type of change
Description of change
This PR allows adapters to have access to a Criteo ID via the user module. It replaces the CriteoRTUS User Module currently available. We will remove it in a following PR and update adapters and documentation accordingly.