Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdYouLike Bidder - Handle advertiser domains in meta objet #6889

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const spec = {
{code: 'bcm'},
{code: 'engageadx'},
{code: 'converge_digital', gvlid: 248},
{code: 'adomega'}
{code: 'adomega'},
{code: 'denakop'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
3 changes: 2 additions & 1 deletion modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ function createBid(response, bidRequests) {
creativeId: response.CreativeID,
cpm: response.Price,
netRevenue: true,
currency: CURRENCY
currency: CURRENCY,
meta: response.Meta || { advertiserDomains: [] }
};

if (request && request.Native) {
Expand Down
3 changes: 3 additions & 0 deletions modules/qwarryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export const spec = {
bid.vastXml = bid.ad;
}

bid.meta = {};
bid.meta.advertiserDomains = bid.adomain || [];

bids.push(bid);
})

Expand Down
5 changes: 4 additions & 1 deletion modules/trustxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst) {
currency: 'USD',
netRevenue: newFormat ? false : priceType !== 'gross',
ttl: TIME_TO_LIVE,
dealId: serverBid.dealid
dealId: serverBid.dealid,
meta: {
advertiserDomains: serverBid.adomain ? serverBid.adomain : []
},
};
if (serverBid.content_type === 'video') {
bidResponse.vastXml = serverBid.adm;
Expand Down
33 changes: 27 additions & 6 deletions test/spec/modules/adyoulikeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ describe('Adyoulike Adapter', function () {
'Placement': 'placement_0'
}
];

const testMetaObject = {
'networkId': 123,
'advertiserId': '3',
'advertiserName': 'foobar',
'advertiserDomains': ['foobar.com'],
'brandId': '345',
'brandName': 'Foo',
'primaryCatId': '34',
'secondaryCatIds': ['IAB-222', 'IAB-333'],
'mediaType': 'banner'
};
const admSample = "\u003cscript id=\"ayl-prebid-a11a121205932e75e622af275681965d\"\u003e\n(function(){\n\twindow.isPrebid = true\n\tvar prebidResults = /*PREBID*/{\"OnEvents\":{\"CLICK\":[{\"Kind\":\"PIXEL_URL\",\"Url\":\"https://testPixelCLICK.com/fake\"}],\"IMPRESSION\":[{\"Kind\":\"PIXEL_URL\",\"Url\":\"https://testPixelIMP.com/fake\"},{\"Kind\":\"JAVASCRIPT_URL\",\"Url\":\"https://testJsIMP.com/fake.js\"}]},\"Disabled\":false,\"Attempt\":\"a11a121205932e75e622af275681965d\",\"ApiPrefix\":\"https://fo-api.omnitagjs.com/fo-api\",\"TrackingPrefix\":\"https://tracking.omnitagjs.com/tracking\",\"DynamicPrefix\":\"https://tag-dyn.omnitagjs.com/fo-dyn\",\"StaticPrefix\":\"https://fo-static.omnitagjs.com/fo-static\",\"BlobPrefix\":\"https://fo-api.omnitagjs.com/fo-api/blobs\",\"SspPrefix\":\"https://fo-ssp.omnitagjs.com/fo-ssp\",\"VisitorPrefix\":\"https://visitor.omnitagjs.com/visitor\",\"Trusted\":true,\"Placement\":\"e622af275681965d3095808561a1e510\",\"PlacementAccess\":\"ALL\",\"Site\":\"6e2df7a92203c3c7a25561ed63f25a27\",\"Lang\":\"EN\",\"SiteLogo\":null,\"HasSponsorImage\":false,\"ResizeIframe\":true,\"IntegrationConfig\":{\"Kind\":\"WIDGET\",\"Widget\":{\"ExtraStyleSheet\":\"\",\"Placeholders\":{\"Body\":{\"Color\":{\"R\":77,\"G\":21,\"B\":82,\"A\":100},\"BackgroundColor\":{\"R\":255,\"G\":255,\"B\":255,\"A\":100},\"FontFamily\":\"Lato\",\"Width\":\"100%\",\"Align\":\"\",\"BoxShadow\":true},\"CallToAction\":{\"Color\":{\"R\":26,\"G\":157,\"B\":212,\"A\":100}},\"Description\":{\"Length\":130},\"Image\":{\"Width\":600,\"Height\":600,\"Lowres\":false,\"Raw\":false},\"Size\":{\"Height\":\"250px\",\"Width\":\"300px\"},\"Sponsor\":{\"Color\":{\"R\":35,\"G\":35,\"B\":35,\"A\":100},\"Label\":true,\"WithoutLogo\":false},\"Title\":{\"Color\":{\"R\":219,\"G\":181,\"B\":255,\"A\":100}}},\"Selector\":{\"Kind\":\"CSS\",\"Css\":\"#ayl-prebid-a11a121205932e75e622af275681965d\"},\"Insertion\":\"AFTER\",\"ClickFormat\":true,\"Creative20\":true,\"WidgetKind\":\"CREATIVE_TEMPLATE_4\"}},\"Legal\":\"Sponsored\",\"ForcedCampaign\":\"f1c80d4bb5643c222ae8de75e9b2f991\",\"ForcedTrack\":\"\",\"ForcedCreative\":\"\",\"ForcedSource\":\"\",\"DisplayMode\":\"DEFAULT\",\"Campaign\":\"f1c80d4bb5643c222ae8de75e9b2f991\",\"CampaignAccess\":\"ALL\",\"CampaignKind\":\"AD_TRAFFIC\",\"DataSource\":\"LOCAL\",\"DataSourceUrl\":\"\",\"DataSourceOnEventsIsolated\":false,\"DataSourceWithoutCookie\":false,\"Content\":{\"Preview\":{\"Thumbnail\":{\"Image\":{\"Kind\":\"EXTERNAL\",\"Data\":{\"External\":{\"Url\":\"https://tag-dyn.omnitagjs.com/fo-dyn/native/preview/image?key=fd4362d35bb174d6f1c80d4bb5643c22\\u0026kind=INTERNAL\\u0026ztop=0.000000\\u0026zleft=0.000000\\u0026zwidth=0.333333\\u0026zheight=1.000000\\u0026width=[width]\\u0026height=[height]\"}},\"ZoneTop\":0,\"ZoneLeft\":0,\"ZoneWidth\":1,\"ZoneHeight\":1,\"Smart\":false,\"NoTransform\":false,\"Quality\":\"NORMAL\"}},\"Text\":{\"CALLTOACTION\":\"Click here to learn more\",\"DESCRIPTION\":\"Considérant l'extrémité conjoncturelle, il serait bon d'anticiper toutes les voies de bon sens.\",\"SPONSOR\":\"Tested by\",\"TITLE\":\"Adserver Traffic Redirect Internal\"},\"Sponsor\":{\"Name\":\"QA Team\"},\"Credit\":{\"Logo\":{\"Resource\":{\"Kind\":\"EXTERNAL\",\"Data\":{\"External\":{\"Url\":\"https://fo-static.omnitagjs.com/fo-static/native/images/info-ayl.png\"}},\"ZoneTop\":0,\"ZoneLeft\":0,\"ZoneWidth\":1,\"ZoneHeight\":1,\"Smart\":false,\"NoTransform\":false,\"Quality\":\"NORMAL\"}},\"Url\":\"https://blobs.omnitagjs.com/adchoice/\"}},\"Landing\":{\"Url\":\"https://www.w3.org/People/mimasa/test/xhtml/entities/entities-11.xhtml#lat1\",\"LegacyTracking\":false},\"ViewButtons\":{\"Close\":{\"Skip\":6000}},\"InternalContentFields\":{\"AnimatedImage\":false}},\"AdDomain\":\"adyoulike.com\",\"Opener\":\"REDIRECT\",\"PerformUITriggers\":[\"CLICK\"],\"RedirectionTarget\":\"TAB\"}/*PREBID*/;\n\tvar insertAds = function insertAds() {\insertAds();\n\t}\n})();\n\u003c/script\u003e";
const responseWithSinglePlacement = [
{
Expand All @@ -298,6 +310,7 @@ describe('Adyoulike Adapter', function () {
'Ad': admSample,
'Price': 0.5,
'Height': 600,
'Meta': testMetaObject
}
];

Expand Down Expand Up @@ -365,7 +378,8 @@ describe('Adyoulike Adapter', function () {
privacyLink: 'https://blobs.omnitagjs.com/adchoice/',
sponsoredBy: 'QA Team',
title: 'Adserver Traffic Redirect Internal',
}
},
meta: testMetaObject
}];

const responseWithMultiplePlacements = [
Expand Down Expand Up @@ -617,6 +631,7 @@ describe('Adyoulike Adapter', function () {
expect(result[0].ad).to.equal(admSample);
expect(result[0].width).to.equal(300);
expect(result[0].height).to.equal(600);
expect(result[0].meta).to.deep.equal(testMetaObject);
});

it('receive reponse with multiple placement', function () {
Expand All @@ -636,22 +651,28 @@ describe('Adyoulike Adapter', function () {
expect(result[1].height).to.equal(250);
});

it('receive reponse with Native ad', function () {
serverResponse.body = responseWithSingleNative;
it('receive reponse with Native from ad markup', function () {
serverResponse.body = responseWithSinglePlacement;
let result = spec.interpretResponse(serverResponse, {data: '{"Bids":' + JSON.stringify(sentBidNative) + '}'});

expect(result.length).to.equal(1);

expect(result).to.deep.equal(nativeResult);
});

it('receive reponse with Native from ad markup', function () {
serverResponse.body = responseWithSinglePlacement;
it('receive reponse with Native ad', function () {
serverResponse.body = responseWithSingleNative;
let result = spec.interpretResponse(serverResponse, {data: '{"Bids":' + JSON.stringify(sentBidNative) + '}'});

expect(result.length).to.equal(1);

expect(result).to.deep.equal(nativeResult);
const noMeta = [...nativeResult];
const metaBackup = noMeta[0].meta;

// this test should return default meta object
noMeta[0].meta = { advertiserDomains: [] };

expect(result).to.deep.equal(noMeta);
});
});
});
10 changes: 8 additions & 2 deletions test/spec/modules/qwarryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const BIDDER_BANNER_RESPONSE = {
'creativeId': 1,
'netRevenue': true,
'winUrl': 'http://test.com',
'format': 'banner'
'format': 'banner',
'adomain': ['test.com']
}]
}

Expand All @@ -49,7 +50,8 @@ const BIDDER_VIDEO_RESPONSE = {
'creativeId': 2,
'netRevenue': true,
'winUrl': 'http://test.com',
'format': 'video'
'format': 'video',
'adomain': ['test.com']
}]
}

Expand Down Expand Up @@ -119,6 +121,8 @@ describe('qwarryBidAdapter', function () {
expect(result[0]).to.have.property('netRevenue').equal(true)
expect(result[0]).to.have.property('winUrl').equal('http://test.com')
expect(result[0]).to.have.property('format').equal('banner')
expect(result[0].meta).to.exist.property('advertiserDomains')
expect(result[0].meta).to.have.property('advertiserDomains').lengthOf(1)
})

it('handles video request : should get correct bid response', function () {
Expand All @@ -136,6 +140,8 @@ describe('qwarryBidAdapter', function () {
expect(result[0]).to.have.property('winUrl').equal('http://test.com')
expect(result[0]).to.have.property('format').equal('video')
expect(result[0]).to.have.property('vastXml').equal('<xml>vast</xml>')
expect(result[0].meta).to.exist.property('advertiserDomains')
expect(result[0].meta).to.have.property('advertiserDomains').lengthOf(1)
})

it('handles no bid response : should get empty array', function () {
Expand Down
44 changes: 43 additions & 1 deletion test/spec/modules/trustxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ describe('TrustXAdapter', function () {

describe('interpretResponse', function () {
const responses = [
{'bid': [{'price': 1.15, 'adm': '<div>test content 1</div>', 'auid': 43, 'h': 250, 'w': 300}], 'seat': '1'},
{'bid': [{'price': 1.15, 'adm': '<div>test content 1</div>', 'auid': 43, 'h': 250, 'w': 300, 'adomain': ['somedomain.com']}], 'seat': '1'},
{'bid': [{'price': 0.5, 'adm': '<div>test content 2</div>', 'auid': 44, 'h': 600, 'w': 300}], 'seat': '1'},
{'bid': [{'price': 0.15, 'adm': '<div>test content 3</div>', 'auid': 43, 'h': 90, 'w': 728}], 'seat': '1'},
{'bid': [{'price': 0, 'auid': 45, 'h': 250, 'w': 300}], 'seat': '1'},
Expand Down Expand Up @@ -699,6 +699,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': ['somedomain.com']
},
}
];

Expand Down Expand Up @@ -756,6 +759,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': ['somedomain.com']
},
},
{
'requestId': '4dff80cc4ee346',
Expand All @@ -769,6 +775,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
},
{
'requestId': '5703af74d0472a',
Expand All @@ -782,6 +791,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
}
];

Expand Down Expand Up @@ -909,6 +921,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
},
{
'requestId': '4e111f1b66e4',
Expand All @@ -922,6 +937,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
},
{
'requestId': '26d6f897b516',
Expand All @@ -935,6 +953,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
},
{
'requestId': '326bde7fbf69',
Expand All @@ -948,6 +969,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
}
];

Expand Down Expand Up @@ -1009,6 +1033,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
},
{
'requestId': '57b2ebe70e16',
Expand All @@ -1022,6 +1049,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'banner',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
}
];

Expand Down Expand Up @@ -1082,6 +1112,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'video',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
'vastXml': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>',
'adResponse': {
'content': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>'
Expand Down Expand Up @@ -1161,6 +1194,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'video',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
'vastXml': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>',
'adResponse': {
'content': '<VAST version=\"3.0\">\n<Ad id=\"21341234\"><\/Ad>\n<\/VAST>'
Expand All @@ -1178,6 +1214,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'video',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
'vastXml': '<VAST version=\"3.0\">\n<Ad id=\"21331274\"><\/Ad>\n<\/VAST>',
'adResponse': {
'content': '<VAST version=\"3.0\">\n<Ad id=\"21331274\"><\/Ad>\n<\/VAST>'
Expand All @@ -1195,6 +1234,9 @@ describe('TrustXAdapter', function () {
'mediaType': 'video',
'netRevenue': true,
'ttl': 360,
'meta': {
'advertiserDomains': []
},
'vastXml': '<VAST version=\"3.0\">\n<Ad id=\"21376532\"><\/Ad>\n<\/VAST>',
'adResponse': {
'content': '<VAST version=\"3.0\">\n<Ad id=\"21376532\"><\/Ad>\n<\/VAST>'
Expand Down