Skip to content

Commit

Permalink
Yieldone bid adapter: Add AudienceOne ID, language, screen_size to pa…
Browse files Browse the repository at this point in the history
…yload (#8511)

* Add DAC ID in yieldone Bid Request

* Add the parameters language, screen_size, fuuid

* Add the parameters language, screen_size, fuuid to spec.js

Co-authored-by: kyoya-takei <[email protected]>
  • Loading branch information
haruka-yamashita2 and kyoya-takei authored Jun 21, 2022
1 parent 3e77176 commit df068a6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
13 changes: 12 additions & 1 deletion modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const spec = {
const transactionId = bidRequest.transactionId;
const unitCode = bidRequest.adUnitCode;
const timeout = config.getConfig('bidderTimeout');
const language = window.navigator.language;
const screenSize = window.screen.width + 'x' + window.screen.height;
const payload = {
v: 'hb1',
p: placementId,
Expand All @@ -40,7 +42,9 @@ export const spec = {
tid: transactionId,
uc: unitCode,
tmax: timeout,
t: 'i'
t: 'i',
language: language,
screen_size: screenSize
};

const mediaType = getMediaType(bidRequest);
Expand Down Expand Up @@ -69,6 +73,13 @@ export const spec = {
payload.imuid = imuid;
}

// DACID
const dacId = deepAccess(bidRequest, 'userId.dacId.id');
if (isStr(dacId) && !isEmpty(dacId)) {
payload.dac_id = dacId;
payload.fuuid = dacId;
}

return {
method: 'GET',
url: ENDPOINT_URL,
Expand Down
45 changes: 43 additions & 2 deletions test/spec/modules/yieldoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,43 @@ describe('yieldoneBidAdapter', function() {
expect(request[0].data.imuid).to.equal('imuid_sample');
});
});

describe('DAC ID', function () {
it('dont send DAC ID if undefined', function () {
const bidRequests = [
{
params: {placementId: '0'},
},
{
params: {placementId: '1'},
userId: {},
},
{
params: {placementId: '2'},
userId: undefined,
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data).to.not.have.property('dac_id');
expect(request[1].data).to.not.have.property('dac_id');
expect(request[2].data).to.not.have.property('dac_id');
expect(request[0].data).to.not.have.property('fuuid');
expect(request[1].data).to.not.have.property('fuuid');
expect(request[2].data).to.not.have.property('fuuid');
});

it('should send DAC ID if available', function () {
const bidRequests = [
{
params: {placementId: '0'},
userId: {dacId: {id: 'dacId_sample'}},
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request[0].data.dac_id).to.equal('dacId_sample');
expect(request[0].data.fuuid).to.equal('dacId_sample');
});
});
});

describe('interpretResponse', function () {
Expand All @@ -413,7 +450,9 @@ describe('yieldoneBidAdapter', function() {
'cb': 12892917383,
'r': 'http%3A%2F%2Flocalhost%3A9876%2F%3Fid%3D74552836',
'uid': '23beaa6af6cdde',
't': 'i'
't': 'i',
'language': 'ja',
'screen_size': '1440x900'
}
}
];
Expand Down Expand Up @@ -486,7 +525,9 @@ describe('yieldoneBidAdapter', function() {
'cb': 12892917383,
'r': 'http%3A%2F%2Flocalhost%3A9876%2F%3Fid%3D74552836',
'uid': '23beaa6af6cdde',
't': 'i'
't': 'i',
'language': 'ja',
'screen_size': '1440x900'
}
}
];
Expand Down

0 comments on commit df068a6

Please sign in to comment.