Skip to content

Commit

Permalink
Richaudience Bid Adapter : add compability with GPID (prebid#9928)
Browse files Browse the repository at this point in the history
* RichaudienceBidAdapter add compability with GPID

* Add Test for gpid

---------

Co-authored-by: richaudience <partnerintegrations@richaudience.com>
  • Loading branch information
2 people authored and Michele Nasti committed Aug 25, 2023
1 parent 4935578 commit ee5c142
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/richaudienceBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const spec = {
scr_rsl: raiGetResolution(),
cpuc: (typeof window.navigator != 'undefined' ? window.navigator.hardwareConcurrency : null),
kws: (!isEmpty(bid.params.keywords) ? bid.params.keywords : null),
schain: bid.schain
schain: bid.schain,
gpid: raiSetPbAdSlot(bid)
};

// TODO: is 'page' the right value here?
Expand Down Expand Up @@ -283,6 +284,14 @@ function raiGetResolution() {
return resolution;
}

function raiSetPbAdSlot(bid) {
let pbAdSlot = '';
if (deepAccess(bid, 'ortb2Imp.ext.data.pbadslot') != null) {
pbAdSlot = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot')
}
return pbAdSlot
}

function raiGetSyncInclude(config) {
try {
let raConfig = null;
Expand Down
44 changes: 44 additions & 0 deletions test/spec/modules/richaudienceBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,37 @@ describe('Richaudience adapter tests', function () {
user: {}
}];

var DEFAULT_PARAMS_NEW_SIZES_GPID = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
ortb2Imp: {
ext: {
gpid: '/19968336/header-bid-tag-1#example-2',
data: {
pbadslot: '/19968336/header-bid-tag-1#example-2'
}
}
},
mediaTypes: {
banner: {
sizes: [
[300, 250], [300, 600], [728, 90], [970, 250]]
}
},
bidder: 'richaudience',
params: {
bidfloor: 0.5,
pid: 'ADb1f40rmi',
supplyType: 'site',
keywords: 'key1=value1;key2=value2'
},
auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
bidRequestsCount: 1,
bidderRequestId: '1858b7382993ca',
transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
user: {}
}];

var DEFAULT_PARAMS_VIDEO_IN = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
Expand Down Expand Up @@ -236,6 +267,7 @@ describe('Richaudience adapter tests', function () {
expect(requestContent).to.have.property('numIframes').and.to.equal(0);
expect(typeof requestContent.scr_rsl === 'string')
expect(typeof requestContent.cpuc === 'number')
expect(typeof requestContent.gpid === 'string')
expect(requestContent).to.have.property('kws').and.to.equal('key1=value1;key2=value2');
})

Expand Down Expand Up @@ -831,6 +863,18 @@ describe('Richaudience adapter tests', function () {
expect(requestContent).to.have.property('schain').to.deep.equal(schain);
})

it('should pass gpid', function() {
const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES_GPID, {
gdprConsent: {
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
gdprApplies: true
},
refererInfo: {}
})
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('gpid').and.to.equal('/19968336/header-bid-tag-1#example-2');
})

describe('userSync', function () {
it('Verifies user syncs iframe include', function () {
config.setConfig({
Expand Down

0 comments on commit ee5c142

Please sign in to comment.