Skip to content

Commit 5c9e0cf

Browse files
update prebid adapter (prebid#10459)
Co-authored-by: Dawid W <[email protected]>
1 parent 36eadbd commit 5c9e0cf

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

modules/optidigitalBidAdapter.js

+12
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ export const spec = {
9090
payload.uspConsent = bidderRequest.uspConsent;
9191
}
9292

93+
if (_getEids(validBidRequests[0])) {
94+
payload.user = {
95+
eids: _getEids(validBidRequests[0])
96+
}
97+
}
98+
9399
const payloadObject = JSON.stringify(payload);
94100
return {
95101
method: 'POST',
@@ -223,6 +229,12 @@ function _getFloor (bid, sizes, currency) {
223229
return floor !== null ? floor : bid.params.floor;
224230
}
225231

232+
function _getEids(bidRequest) {
233+
if (deepAccess(bidRequest, 'userIdAsEids')) {
234+
return bidRequest.userIdAsEids;
235+
}
236+
}
237+
226238
export function resetSync() {
227239
isSynced = false;
228240
}

modules/optidigitalBidAdapter.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ Bidder Adapter for Prebid.js.
3737

3838
```
3939
pbjs.setConfig({
40-
userSync: {
41-
iframeEnabled: true,
42-
syncEnabled: true,
43-
syncDelay: 3000
44-
}
40+
  userSync: {
41+
    filterSettings: {
42+
      iframe: {
43+
        bidders: '*', // '*' represents all bidders
44+
        filter: 'include'
45+
      }
46+
    }
47+
  }
4548
});
4649
```

test/spec/modules/optidigitalBidAdapter_spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,28 @@ describe('optidigitalAdapterTests', function () {
479479
expect(payload.imp[0].bidFloor).to.exist;
480480
});
481481

482+
it('should add userEids to payload', function() {
483+
const userIdAsEids = [{
484+
source: 'pubcid.org',
485+
uids: [{
486+
id: '121213434342343',
487+
atype: 1
488+
}]
489+
}];
490+
validBidRequests[0].userIdAsEids = userIdAsEids;
491+
bidderRequest.userIdAsEids = userIdAsEids;
492+
const request = spec.buildRequests(validBidRequests, bidderRequest);
493+
const payload = JSON.parse(request.data);
494+
expect(payload.user.eids).to.deep.equal(userIdAsEids);
495+
});
496+
497+
it('should not add userIdAsEids to payload when userIdAsEids is not present', function() {
498+
validBidRequests[0].userIdAsEids = undefined;
499+
const request = spec.buildRequests(validBidRequests, bidderRequest);
500+
const payload = JSON.parse(request.data);
501+
expect(payload.user).to.deep.equal(undefined);
502+
});
503+
482504
function returnBannerSizes(mediaTypes, expectedSizes) {
483505
const bidRequest = Object.assign(validBidRequests[0], mediaTypes);
484506
const request = spec.buildRequests([bidRequest], bidderRequest);

0 commit comments

Comments
 (0)