Skip to content
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

Yieldone bid adapter: Add AudienceOne ID, language, screen_size to payload #8511

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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 @@ -39,7 +41,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 @@ -68,6 +72,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