Teads Bid Adapter: support floc and uid2 user IDs#7116
Teads Bid Adapter: support floc and uid2 user IDs#7116robertrmartinez merged 3 commits intoprebid:masterfrom
Conversation
modules/teadsBidAdapter.js
Outdated
There was a problem hiding this comment.
What exactly is going on here?
This looks like some macro to be replaced but I do not see it happening anywhere in your adapter?
SSP_PORT_8080_TCP_ADDR:SSP_PORT_8080_TCP_PORT
There was a problem hiding this comment.
yes it's an error on our side, we will revert that change! (edit: fixed in 2nd commit)
modules/teadsBidAdapter.js
Outdated
There was a problem hiding this comment.
Think it would be better to just init your storage manager top level of module
You are calling this function every single time anyways.
robertrmartinez
left a comment
There was a problem hiding this comment.
couple questions
fe37af5 to
247dfc8
Compare
|
Hello @robertrmartinez , we have done the changes following your questions. |
robertrmartinez
left a comment
There was a problem hiding this comment.
Adapter looks good but would like the storage code to be stubbed in the tests.
We are trying to be more diligent about not letting people modify the window during tests, setting local storage and cookies is not reliable, especially when you have many adapters doing so.
Please see the examples I just gave and update the spec file.
Thanks, let me know if you have any questions
| }); | ||
|
|
||
| it('should add firstPartyCookieTeadsId param to payload if first-party cookie is available', function () { | ||
| storage.setCookie('_tfpvi', 'my-teads-id'); |
There was a problem hiding this comment.
We do not want to actually be setting and reading from storage / cookies inside of tests.
We should be mocking the stubbing / mocking the storage manager, which has its own tests to verify it works.
Here is an example:
You'll need to export your storage var so that your tests can mock it:
https://github.com/prebid/Prebid.js/blob/master/modules/rubiconAnalyticsAdapter.js#L11
Then in your beforeEach you should setup the stub
https://github.com/prebid/Prebid.js/blob/master/test/spec/modules/rubiconAnalyticsAdapter_spec.js#L596-L600
Don't forget to restore it back in the afterEach
https://github.com/prebid/Prebid.js/blob/master/test/spec/modules/rubiconAnalyticsAdapter_spec.js#L629-L631
Then in your tests you can set them up to return what you want and make sure your module works as expected:
https://github.com/prebid/Prebid.js/blob/master/test/spec/modules/rubiconAnalyticsAdapter_spec.js#L1297
| // Following the introduction of tests involving reading/writing cookies, | ||
| // this allows for running this spec as a single file with: | ||
| // `gulp test --file "test/spec/modules/teadsBidAdapter_spec.js"`. | ||
| window.$$PREBID_GLOBAL$$.processQueue(); |
There was a problem hiding this comment.
With the stubbing of storage, you can get rid of this I believe.
This type of code in test files can cause downstream tests to be very flakey.
We do not want to modify the window object and its contents if we do not have to in tests.
|
Thanks @robertrmartinez, it's so much better/stable to use a stub rather than the global environment! 👍 |
robertrmartinez
left a comment
There was a problem hiding this comment.
Awesome stuff
Thanks for being so flexible!
Type of change
Description of change
Support FLoC ID (
flocId) and Unified ID v2 (uid2Id) user IDs in the Teads adapter.Additionally, read the
_tfpvifirst-party cookie when available on the website's domain.Documentation has been updated on the
prebid.github.iorepository: prebid/prebid.github.io#3072.Contact email of the adapter’s maintainer : innov-ssp@teads.tv.