Skip to content

Commit

Permalink
TrustX Bid Adapter: added vastUrl support (prebid#7531)
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
  • Loading branch information
PWyrembak authored and Chris Pabst committed Jan 10, 2022
1 parent d2502fb commit dc02129
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
14 changes: 9 additions & 5 deletions modules/trustxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst) {
if (!serverBid) return;
let errorMessage;
if (!serverBid.auid) errorMessage = LOG_ERROR_MESS.noAuid + JSON.stringify(serverBid);
if (!serverBid.adm) errorMessage = LOG_ERROR_MESS.noAdm + JSON.stringify(serverBid);
if (!serverBid.adm && !serverBid.nurl) errorMessage = LOG_ERROR_MESS.noAdm + JSON.stringify(serverBid);
else {
const { bidsMap } = bidRequest;
const bid = bidsMap[serverBid.impid];
Expand All @@ -336,11 +336,15 @@ function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst) {
},
};
if (serverBid.content_type === 'video') {
bidResponse.vastXml = serverBid.adm;
if (serverBid.adm) {
bidResponse.vastXml = serverBid.adm;
bidResponse.adResponse = {
content: bidResponse.vastXml
};
} else if (serverBid.nurl) {
bidResponse.vastUrl = serverBid.nurl;
}
bidResponse.mediaType = VIDEO;
bidResponse.adResponse = {
content: bidResponse.vastXml
};
if (!bid.renderer && (!bid.mediaTypes || !bid.mediaTypes.video || bid.mediaTypes.video.context === 'outstream')) {
bidResponse.renderer = createRenderer(bidResponse, {
id: bid.bidId,
Expand Down
37 changes: 35 additions & 2 deletions test/spec/modules/trustxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,11 +1052,28 @@ describe('TrustXAdapter', function () {
'context': 'instream'
}
}
},
{
'bidder': 'trustx',
'params': {
'uid': '52'
},
'adUnitCode': 'adunit-code-1',
'sizes': [[300, 250], [300, 600]],
'bidId': '23312a43bc42',
'bidderRequestId': '20394420a762a2',
'auctionId': '140132d07b031',
'mediaTypes': {
'video': {
'context': 'instream'
}
}
}
];
const response = [
{'bid': [{'impid': '57dfefb80eca', 'price': 1.15, 'adm': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>', 'auid': 50, content_type: 'video', w: 300, h: 600}], 'seat': '2'},
{'bid': [{'impid': '5126e301f4be', 'price': 1.00, 'adm': '<VAST version=\"3.0\">\n<Ad id=\"21331274\"><\/Ad>\n<\/VAST>', 'auid': 51, content_type: 'video'}], 'seat': '2'}
{'bid': [{'impid': '5126e301f4be', 'price': 1.00, 'adm': '<VAST version=\"3.0\">\n<Ad id=\"21331274\"><\/Ad>\n<\/VAST>', 'auid': 51, content_type: 'video'}], 'seat': '2'},
{'bid': [{'impid': '23312a43bc42', 'price': 2.00, 'nurl': 'https://some_test_vast_url.com', 'auid': 52, content_type: 'video', w: 300, h: 600}], 'seat': '2'},
];
const request = spec.buildRequests(bidRequests);
const expectedResponse = [
Expand All @@ -1078,7 +1095,23 @@ describe('TrustXAdapter', function () {
'adResponse': {
'content': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>'
}
}
},
{
'requestId': '23312a43bc42',
'cpm': 2.00,
'creativeId': 52,
'dealId': undefined,
'width': 300,
'height': 600,
'currency': 'USD',
'mediaType': 'video',
'netRevenue': false,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
'vastUrl': 'https://some_test_vast_url.com',
},
];

const result = spec.interpretResponse({'body': {'seatbid': response}}, request);
Expand Down

0 comments on commit dc02129

Please sign in to comment.