Skip to content

Commit

Permalink
AdYouLike bidder adapter: update video endpoint (#8166)
Browse files Browse the repository at this point in the history
* add required clickurl in every native adrequest

* allows the native response to be given as is to prebid if possible

* add unit tests on new Native case

* Handle meta object in bid response with default addomains array

* fix icon retrieval in Native case

* Update priorities in case of multiple mediatypes given

* improve robustness and fix associated unit test on picture urls

* add support for params.size parameter

* add unit test on new size format

* Makes sure the playerSize format is consistent

* enable Vast response on bidder adapter

* fix lint errors

* add test on Vast format case

* add userId to bidrequest

* revert package-lock.json changes

* improve multiple mediatype handling

* Expose adyoulike GVL id

* fix icurl issue when retreiving icon for Native mediatype

* update unit tests on icon url in native mediatype

* target video endpoint when video mediatype is present

* add unit test on video endpoint

* detect if bid request has video

* remove console log
  • Loading branch information
guiann authored Mar 14, 2022
1 parent da57e85 commit 073ccd3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
let hasVideo = false;
const payload = {
Version: VERSION,
Bids: bidRequests.reduce((accumulator, bidReq) => {
Expand Down Expand Up @@ -88,6 +89,7 @@ export const spec = {
accumulator[bidReq.bidId].Native = nativeReq;
}
if (mediatype === VIDEO) {
hasVideo = true;
accumulator[bidReq.bidId].Video = bidReq.mediaTypes.video;

const size = bidReq.mediaTypes.video.playerSize;
Expand Down Expand Up @@ -122,7 +124,7 @@ export const spec = {

return {
method: 'POST',
url: createEndpoint(bidRequests, bidderRequest),
url: createEndpoint(bidRequests, bidderRequest, hasVideo),
data,
options
};
Expand Down Expand Up @@ -217,12 +219,13 @@ function getPageRefreshed() {
}

/* Create endpoint url */
function createEndpoint(bidRequests, bidderRequest) {
function createEndpoint(bidRequests, bidderRequest, hasVideo) {
let host = getHostname(bidRequests);
const endpoint = hasVideo ? '/hb-api/prebid-video/v1' : '/hb-api/prebid/v1';
return buildUrl({
protocol: 'https',
host: `${DEFAULT_DC}${host}.omnitagjs.com`,
pathname: '/hb-api/prebid/v1',
pathname: endpoint,
search: createEndpointQS(bidderRequest)
});
}
Expand Down
25 changes: 25 additions & 0 deletions test/spec/modules/adyoulikeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,26 @@ describe('Adyoulike Adapter', function () {
}
];

const bidRequestWithVideo = [
{
'bidId': 'bid_id_0',
'bidder': 'adyoulike',
'placementCode': 'adunit/hb-0',
'params': {
'placement': 'placement_0'
},
'sizes': '300x250',
'mediaTypes':
{
'video': {
'context': 'instream',
'playerSize': [[ 640, 480 ]]
}
},
'transactionId': 'bid_id_0_transaction_id'
}
];

const bidRequestWithNativeImageType = [
{
'bidId': 'bid_id_0',
Expand Down Expand Up @@ -586,6 +606,11 @@ describe('Adyoulike Adapter', function () {
expect(payload.Bids['bid_id_0'].Native).deep.equal(sentNativeImageType);
});

it('Should target video enpoint for video mediatype', function() {
const request = spec.buildRequests(bidRequestWithVideo, bidderRequest);
expect(request.url).to.contain(getEndpoint());
});

it('should add gdpr/usp consent information to the request', function () {
let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
let uspConsentData = '1YCC';
Expand Down

0 comments on commit 073ccd3

Please sign in to comment.