Skip to content

Commit 7049051

Browse files
authored
support for GPID (prebid#13026)
1 parent 9d8df5c commit 7049051

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

modules/yieldoneBidAdapter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ export const spec = {
119119
payload.uid2id = uid2;
120120
}
121121

122+
// GPID
123+
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.gpid');
124+
if (isStr(gpid) && !isEmpty(gpid)) {
125+
payload.gpid = gpid;
126+
}
127+
122128
return {
123129
method: 'GET',
124130
url: ENDPOINT_URL,

test/spec/modules/yieldoneBidAdapter_spec.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,46 @@ describe('yieldoneBidAdapter', function () {
508508
expect(request[0].data.uid2id).to.equal('uid2_sample');
509509
});
510510
});
511+
512+
describe('GPID', function () {
513+
it('dont send GPID if undefined', function () {
514+
const bidRequests = [
515+
{
516+
params: {placementId: '0'},
517+
},
518+
{
519+
params: {placementId: '1'},
520+
ortb2Imp: {},
521+
},
522+
{
523+
params: {placementId: '2'},
524+
ortb2Imp: undefined,
525+
},
526+
{
527+
params: {placementId: '3'},
528+
ortb2Imp: {ext: {gpid: undefined, data: {pubadslot: 'aaa'}}},
529+
},
530+
];
531+
const request = spec.buildRequests(bidRequests, bidderRequest);
532+
expect(request[0].data).to.not.have.property('gpid');
533+
expect(request[1].data).to.not.have.property('gpid');
534+
expect(request[2].data).to.not.have.property('gpid');
535+
expect(request[3].data).to.not.have.property('gpid');
536+
});
537+
538+
it('should send GPID if available', function () {
539+
const bidRequests = [
540+
{
541+
params: {placementId: '0'},
542+
ortb2Imp: {ext: {gpid: 'gpid_sample'}},
543+
},
544+
];
545+
const request = spec.buildRequests(bidRequests, bidderRequest);
546+
expect(request[0].data.ext).to.be.not.null;
547+
expect(request[0].data).to.have.property('gpid');
548+
expect(request[0].data.gpid).to.equal('gpid_sample');
549+
});
550+
});
511551
});
512552

513553
describe('interpretResponse', function () {

0 commit comments

Comments
 (0)