Skip to content

Commit

Permalink
Smartadserver Bid Adapter: support GPID (#10004)
Browse files Browse the repository at this point in the history
* Smartadserver Bid Adapter: Add support for SDA user and site

* Smartadserver Bid Adapter: Fix SDA support getConfig and add to unit testing

* support floors per media type

* Add GPP support

* Rework payloads enriching

* Add gpid support

---------

Co-authored-by: Meven Courouble <mcourouble@smartadserver.com>
Co-authored-by: Krzysztof Sokół <88041828+smart-adserver@users.noreply.github.com>
  • Loading branch information
3 people authored May 30, 2023
1 parent fc6bced commit 7cbedf0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ export const spec = {
sdc: sellerDefinedContext
};

const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid', deepAccess(bid, 'ortb2Imp.ext.data.pbadslot', ''));
if (gpid) {
payload.gpid = gpid;
}

if (bidderRequest) {
if (bidderRequest.gdprConsent) {
payload.addtl_consent = bidderRequest.gdprConsent.addtlConsent;
Expand Down
42 changes: 42 additions & 0 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { BANNER, VIDEO } from 'src/mediaTypes.js';
import { config } from 'src/config.js';
import { deepClone } from 'src/utils.js';
import { spec } from 'modules/smartadserverBidAdapter.js';

// Default params with optional ones
Expand Down Expand Up @@ -1339,4 +1340,45 @@ describe('Smart bid adapter tests', function () {
expect(bannerRequest).to.have.property('formatid').and.to.equal('90');
});
});

describe('Global Placement ID (GPID)', function () {
it('should not include gpid by default', () => {
const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL);
const requestContent = JSON.parse(request[0].data);

expect(requestContent).to.not.have.property('gdid');
});

it('should include gpid if pbadslot in ortb2Imp', () => {
const gpid = '/19968336/header-bid-tag-1';
const bidRequests = deepClone(DEFAULT_PARAMS_WO_OPTIONAL);

bidRequests[0].ortb2Imp = {
ext: {
data: {
pbadslot: gpid
}
}
};

const request = spec.buildRequests(bidRequests);
const requestContent = JSON.parse(request[0].data);

expect(requestContent).to.have.property('gpid').and.to.equal(gpid);
});

it('should include gpid if imp[].ext.gpid exists', () => {
const gpid = '/1111/homepage#div-leftnav';
const bidRequests = deepClone(DEFAULT_PARAMS_WO_OPTIONAL);

bidRequests[0].ortb2Imp = {
ext: { gpid }
};

const request = spec.buildRequests(bidRequests);
const requestContent = JSON.parse(request[0].data);

expect(requestContent).to.have.property('gpid').and.to.equal(gpid);
});
});
});

0 comments on commit 7cbedf0

Please sign in to comment.