Skip to content

Commit

Permalink
TrustX Bid Adapter: added support of PBAdSlot module (prebid#7653)
Browse files Browse the repository at this point in the history
* Add trustx adapter and tests for it

* update integration example

* Update trustx adapter

* Post-review fixes of Trustx adapter

* Code improvement for trustx adapter: changed default price type from gross to net

* Update TrustX adapter to support the 1.0 version

* Make requested changes for TrustX adapter

* Updated markdown file for TrustX adapter

* Fix TrustX adapter and spec file

* Update TrustX adapter: r parameter was added to ad request as cache buster

* Add support of gdpr to Trustx Bid Adapter

* Add wtimeout to ad request params for TrustX Bid Adapter

* TrustX Bid Adapter: remove last ampersand in the ad request

* Update TrustX Bid Adapter to support identical uids in parameters

* Update TrustX Bid Adapter to ignore bids that sizes do not match the size of the request

* Update TrustX Bid Adapter to support instream and outstream video

* Added wrapperType and wrapperVersion parameters in ad request for TrustX Bid Adapter

* Update TrustX Bid Adapter to use refererInfo instead depricated function utils.getTopWindowUrl

* HOTFIX for referrer encodind in TrustX Bid Adapter

* Fix test for TrustX Bid Adapter

* TrustX Bid Adapter: added keywords passing support

* TrustX Bid Adapter: added us_privacy parameter in bid request

* TrustX Bid Adapter: fix us_privacy parameter in bid request

* Fix alias error for TrustX Bid Adapter

* TrustX Bid Adapter: added new request format

* TrustX Bid adapter: fix new format endpoint

* TrustX Bid Adapter: update md file to support useNewFormat parameter

* TrustX Bid Adapter: added additional sync url

* TrustX Bid Adapter: added check for enabled syncs number + added gdpr data to sync urls

* TrustX Bid Adapter: added support of meta.advertiserDomains

* TrustX Bid Adapter: added support rtd permutive and jwplayer for new and old request format

* TrustX Bid Adapter: Use new format by default + new keywords logic

* TrustX Bid Adapter: fix md file

* TrustX: Convert all id-like request fields to a string

* TrustX: added vastUrl support

* TrustX: fix segments format

* TrustX: added support of PBAdSlot module
  • Loading branch information
PWyrembak authored and Chris Pabst committed Jan 10, 2022
1 parent da56a0f commit b506c0c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/trustxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const spec = {
if (!userIdAsEids) {
userIdAsEids = bid.userIdAsEids;
}
const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd} = bid;
const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp} = bid;
bidsMap[bidId] = bid;
const bidFloor = _getFloor(mediaTypes || {}, bid);
if (rtd) {
Expand All @@ -102,6 +102,15 @@ export const spec = {
}
};

if (ortb2Imp && ortb2Imp.ext && ortb2Imp.ext.data) {
impObj.ext.data = ortb2Imp.ext.data;
if (impObj.ext.data.adserver && impObj.ext.data.adserver.adslot) {
impObj.ext.gpid = impObj.ext.data.adserver.adslot.toString();
} else {
impObj.ext.gpid = ortb2Imp.ext.data.pbadslot && ortb2Imp.ext.data.pbadslot.toString();
}
}

if (!isEmpty(keywords)) {
if (!pageKeywords) {
pageKeywords = keywords;
Expand Down
42 changes: 42 additions & 0 deletions test/spec/modules/trustxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,48 @@ describe('TrustXAdapter', function () {
expect(payload.tmax).to.equal(3000);
getConfigStub.restore();
});
it('should contain imp[].ext.data.adserver if available', function() {
const ortb2Imp = [{
ext: {
data: {
adserver: {
name: 'ad_server_name',
adslot: '/111111/slot'
},
pbadslot: '/111111/slot'
}
}
}, {
ext: {
data: {
adserver: {
name: 'ad_server_name',
adslot: '/222222/slot'
},
pbadslot: '/222222/slot'
}
}
}];
const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
return Object.assign(ortb2Imp[ind] ? { ortb2Imp: ortb2Imp[ind] } : {}, bid);
});
const request = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
expect(request.data).to.be.an('string');
const payload = parseRequest(request.data);
expect(payload.imp[0].ext).to.deep.equal({
divid: bidRequests[0].adUnitCode,
data: ortb2Imp[0].ext.data,
gpid: ortb2Imp[0].ext.data.adserver.adslot
});
expect(payload.imp[1].ext).to.deep.equal({
divid: bidRequests[1].adUnitCode,
data: ortb2Imp[1].ext.data,
gpid: ortb2Imp[1].ext.data.adserver.adslot
});
expect(payload.imp[2].ext).to.deep.equal({
divid: bidRequests[2].adUnitCode
});
});
it('all id like request fields must be a string', function () {
const bidderRequestWithNumId = Object.assign({}, bidderRequest, { bidderRequestId: 123123, auctionId: 345345543 });

Expand Down

0 comments on commit b506c0c

Please sign in to comment.