diff --git a/modules/adheseBidAdapter.js b/modules/adheseBidAdapter.js
index 4fae85e82ad..b9dbae529ba 100644
--- a/modules/adheseBidAdapter.js
+++ b/modules/adheseBidAdapter.js
@@ -34,6 +34,7 @@ export const spec = {
const payload = {
slots: slots,
parameters: commonParams,
+ vastContentAsUrl: true,
user: {
ext: {
eids: getEids(validBidRequests),
@@ -95,7 +96,7 @@ function adResponse(bid, ad) {
const bidResponse = getbaseAdResponse({
requestId: bid.bidId,
- mediaType: getMediaType(markup),
+ mediaType: ad.extension.mediaType,
cpm: Number(price.amount),
currency: price.currency,
width: Number(ad.width),
@@ -110,7 +111,11 @@ function adResponse(bid, ad) {
});
if (bidResponse.mediaType === VIDEO) {
- bidResponse.vastXml = markup;
+ if (ad.cachedBodyUrl) {
+ bidResponse.vastUrl = ad.cachedBodyUrl
+ } else {
+ bidResponse.vastXml = markup;
+ }
} else {
const counter = ad.impressionCounter ? "" : '';
bidResponse.ad = markup + counter;
@@ -172,11 +177,6 @@ function isAdheseAd(ad) {
return !ad.origin || ad.origin === 'JERLICIA';
}
-function getMediaType(markup) {
- const isVideo = markup.trim().toLowerCase().match(/<\?xml|',
tracker: 'https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a',
impressionCounter: 'https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a',
- extension: {'prebid': {'cpm': {'amount': '1.000000', 'currency': 'USD'}}}
+ extension: {'prebid': {'cpm': {'amount': '1.000000', 'currency': 'USD'}}, mediaType: 'banner'}
}
]
};
@@ -227,7 +233,7 @@ describe('AdheseAdapter', function () {
width: '640',
height: '350',
body: '',
- extension: {'prebid': {'cpm': {'amount': '2.1', 'currency': 'USD'}}}
+ extension: {'prebid': {'cpm': {'amount': '2.1', 'currency': 'USD'}}, mediaType: 'video'}
}
]
};
@@ -253,6 +259,43 @@ describe('AdheseAdapter', function () {
expect(spec.interpretResponse(sspVideoResponse, bidRequest)).to.deep.equal(expectedResponse);
});
+ it('should get correct ssp cache video response', () => {
+ let sspCachedVideoResponse = {
+ body: [
+ {
+ origin: 'RUBICON',
+ ext: 'js',
+ slotName: '_main_page_-leaderboard',
+ adType: 'leaderboard',
+ width: '640',
+ height: '350',
+ cachedBodyUrl: 'https://ads-demo.adhese.com/content/38983ccc-4083-4c24-932c-96f798d969b3',
+ extension: {'prebid': {'cpm': {'amount': '2.1', 'currency': 'USD'}}, mediaType: 'video'}
+ }
+ ]
+ };
+
+ let expectedResponse = [{
+ requestId: BID_ID,
+ vastUrl: 'https://ads-demo.adhese.com/content/38983ccc-4083-4c24-932c-96f798d969b3',
+ cpm: 2.1,
+ currency: 'USD',
+ creativeId: 'RUBICON',
+ dealId: '',
+ width: 640,
+ height: 350,
+ mediaType: 'video',
+ netRevenue: NET_REVENUE,
+ ttl: TTL,
+ adhese: {
+ origin: 'RUBICON',
+ originInstance: '',
+ originData: {}
+ }
+ }];
+ expect(spec.interpretResponse(sspCachedVideoResponse, bidRequest)).to.deep.equal(expectedResponse);
+ });
+
it('should get correct Adhese banner response', () => {
const adheseBannerResponse = {
body: [
@@ -290,7 +333,8 @@ describe('AdheseAdapter', function () {
amount: '5.96',
currency: 'USD'
}
- }
+ },
+ mediaType: 'banner'
}
}
]
@@ -352,7 +396,10 @@ describe('AdheseAdapter', function () {
impressionCounter: 'https://hosts-demo.adhese.com/track/742898',
origin: 'JERLICIA',
originData: {},
- auctionable: true
+ auctionable: true,
+ extension: {
+ mediaType: 'video'
+ }
}
]
};
@@ -390,6 +437,70 @@ describe('AdheseAdapter', function () {
expect(spec.interpretResponse(adheseVideoResponse, bidRequest)).to.deep.equal(expectedResponse);
});
+ it('should get correct Adhese cached video response', () => {
+ const adheseVideoResponse = {
+ body: [
+ {
+ adType: 'preroll',
+ adFormat: '',
+ orderId: '22248',
+ adspaceId: '164196',
+ body: '',
+ height: '360',
+ width: '640',
+ extension: {
+ mediaType: 'video'
+ },
+ cachedBodyUrl: 'https://ads-demo.adhese.com/content/38983ccc-4083-4c24-932c-96f798d969b3',
+ libId: '89860',
+ id: '742470',
+ advertiserId: '2263',
+ ext: 'advar',
+ orderName: 'Smartphoto EOY-20181112',
+ creativeName: 'PREROLL',
+ slotName: '_main_page_-leaderboard',
+ slotID: '41711',
+ impressionCounter: 'https://hosts-demo.adhese.com/track/742898',
+ origin: 'JERLICIA',
+ originData: {},
+ auctionable: true
+ }
+ ]
+ };
+
+ let expectedResponse = [{
+ requestId: BID_ID,
+ vastUrl: 'https://ads-demo.adhese.com/content/38983ccc-4083-4c24-932c-96f798d969b3',
+ adhese: {
+ origin: '',
+ originInstance: '',
+ originData: {
+ adFormat: '',
+ adId: '742470',
+ adType: 'preroll',
+ adspaceId: '164196',
+ libId: '89860',
+ orderProperty: undefined,
+ priority: undefined,
+ viewableImpressionCounter: undefined,
+ slotId: '41711',
+ slotName: '_main_page_-leaderboard',
+ advertiserId: '2263',
+ }
+ },
+ cpm: 0,
+ currency: 'USD',
+ creativeId: '742470',
+ dealId: '22248',
+ width: 640,
+ height: 360,
+ mediaType: 'video',
+ netRevenue: NET_REVENUE,
+ ttl: TTL,
+ }];
+ expect(spec.interpretResponse(adheseVideoResponse, bidRequest)).to.deep.equal(expectedResponse);
+ });
+
it('should return no bids for empty adserver response', () => {
let adserverResponse = { body: [] };
expect(spec.interpretResponse(adserverResponse, bidRequest)).to.be.empty;