diff --git a/modules/yahoosspBidAdapter.js b/modules/yahoosspBidAdapter.js
index 7a414c0d2ee..a66d76f8689 100644
--- a/modules/yahoosspBidAdapter.js
+++ b/modules/yahoosspBidAdapter.js
@@ -6,9 +6,10 @@ import { Renderer } from '../src/Renderer.js';
import {hasPurpose1Consent} from '../src/utils/gpdr.js';
const INTEGRATION_METHOD = 'prebid.js';
-const BIDDER_CODE = 'yahoossp';
+const BIDDER_CODE = 'yahooAds';
+const BIDDER_ALIASES = ['yahoossp', 'yahooAdvertising']
const GVLID = 25;
-const ADAPTER_VERSION = '1.0.2';
+const ADAPTER_VERSION = '1.1.0';
const PREBID_VERSION = '$prebid.version$';
const DEFAULT_BID_TTL = 300;
const TEST_MODE_DCN = '8a969516017a7a396ec539d97f540011';
@@ -49,13 +50,17 @@ const SUPPORTED_USER_ID_SOURCES = [
'quantcast.com',
'tapad.com',
'uidapi.com',
- 'verizonmedia.com',
'yahoo.com',
'zeotap.com'
];
/* Utility functions */
+function getConfigValue(bid, key) {
+ const bidderCode = bid.bidder || bid.bidderCode;
+ return config.getConfig(`${bidderCode}.${key}`);
+}
+
function getSize(size) {
return {
w: parseInt(size[0]),
@@ -114,11 +119,12 @@ function extractUserSyncUrls(syncOptions, pixels) {
*/
function updateConsentQueryParams(url, consentData) {
const parameterMap = {
- 'gdpr_consent': consentData.gdpr.consentString,
- 'gdpr': consentData.gdpr.gdprApplies ? '1' : '0',
- 'us_privacy': consentData.uspConsent,
- 'gpp': consentData.gpp.gppString,
- 'gpp_sid': consentData.gpp.applicableSections ? consentData.gpp.applicableSections.join(',') : ''
+ 'gdpr_consent': consentData.gdpr ? consentData.gdpr.consentString : '',
+ 'gdpr': consentData.gdpr && consentData.gdpr.gdprApplies ? '1' : '0',
+ 'us_privacy': consentData.uspConsent ? consentData.uspConsent : '',
+ 'gpp': consentData.gpp ? consentData.gpp.gppString : '',
+ 'gpp_sid': consentData.gpp && Array.isArray(consentData.gpp.applicableSections)
+ ? consentData.gpp.applicableSections.join(',') : ''
}
const existingUrl = new URL(url);
@@ -155,8 +161,8 @@ function getPubIdMode(bid) {
return pubIdMode;
};
-function getAdapterMode() {
- let adapterMode = config.getConfig('yahoossp.mode');
+function getAdapterMode(bid) {
+ let adapterMode = getConfigValue(bid, 'mode');
adapterMode = adapterMode ? adapterMode.toLowerCase() : undefined;
if (typeof adapterMode === 'undefined' || adapterMode === BANNER) {
return BANNER;
@@ -177,7 +183,7 @@ function getResponseFormat(bid) {
};
function getFloorModuleData(bid) {
- const adapterMode = getAdapterMode();
+ const adapterMode = getAdapterMode(bid);
const getFloorRequestObject = {
currency: deepAccess(bid, 'params.bidOverride.cur') || DEFAULT_CURRENCY,
mediaType: adapterMode,
@@ -187,7 +193,7 @@ function getFloorModuleData(bid) {
};
function filterBidRequestByMode(validBidRequests) {
- const mediaTypesMode = getAdapterMode();
+ const mediaTypesMode = getAdapterMode(validBidRequests[0]);
let result = [];
if (mediaTypesMode === BANNER) {
result = validBidRequests.filter(bid => {
@@ -244,7 +250,7 @@ function validateAppendObject(validationType, allowedKeys, inputObject, appendTo
};
function getTtl(bidderRequest) {
- const globalTTL = config.getConfig('yahoossp.ttl');
+ const globalTTL = getConfigValue(bidderRequest, 'ttl');
return globalTTL ? validateTTL(globalTTL) : validateTTL(deepAccess(bidderRequest, 'params.ttl'));
};
@@ -276,8 +282,8 @@ function generateOpenRtbObject(bidderRequest, bid) {
ext: {
'us_privacy': bidderRequest.uspConsent ? bidderRequest.uspConsent : '',
gdpr: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? 1 : 0,
- gpp: bidderRequest.gppConsent.gppString,
- gpp_sid: bidderRequest.gppConsent.applicableSections
+ gpp: bidderRequest.gppConsent ? bidderRequest.gppConsent.gppString : '',
+ gpp_sid: bidderRequest.gppConsent ? bidderRequest.gppConsent.applicableSections : []
}
},
source: {
@@ -332,7 +338,7 @@ function generateOpenRtbObject(bidderRequest, bid) {
};
function appendImpObject(bid, openRtbObject) {
- const mediaTypeMode = getAdapterMode();
+ const mediaTypeMode = getAdapterMode(bid);
if (openRtbObject && bid) {
const impObject = {
@@ -494,20 +500,21 @@ function appendFirstPartyData(outBoundBidRequest, bid) {
function generateServerRequest({payload, requestOptions, bidderRequest}) {
const pubIdMode = getPubIdMode(bidderRequest);
- let sspEndpoint = config.getConfig('yahoossp.endpoint') || SSP_ENDPOINT_DCN_POS;
+ const overrideEndpoint = getConfigValue(bidderRequest, 'endpoint');
+ let sspEndpoint = overrideEndpoint || SSP_ENDPOINT_DCN_POS;
if (pubIdMode === true) {
- sspEndpoint = config.getConfig('yahoossp.endpoint') || SSP_ENDPOINT_PUBID;
+ sspEndpoint = overrideEndpoint || SSP_ENDPOINT_PUBID;
};
if (deepAccess(bidderRequest, 'params.testing.e2etest') === true) {
- logInfo('yahoossp adapter e2etest mode is active');
+ logInfo('Adapter e2etest mode is active');
requestOptions.withCredentials = false;
if (pubIdMode === true) {
payload.site.id = TEST_MODE_PUBID_DCN;
} else {
- const mediaTypeMode = getAdapterMode();
+ const mediaTypeMode = getAdapterMode(bidderRequest);
payload.site.id = TEST_MODE_DCN;
payload.imp.forEach(impObject => {
impObject.ext.e2eTestMode = true;
@@ -516,8 +523,9 @@ function generateServerRequest({payload, requestOptions, bidderRequest}) {
} else if (mediaTypeMode === VIDEO) {
impObject.tagid = TEST_MODE_VIDEO_POS; // video passback
} else {
- logWarn('yahoossp adapter e2etest mode does not support yahoossp.mode="all". \n Please specify either "banner" or "video"');
- logWarn('yahoossp adapter e2etest mode: Please make sure your adUnit matches the yahoossp.mode video or banner');
+ const bidderCode = bidderRequest.bidderCode;
+ logWarn(`e2etest mode does not support ${bidderCode}.mode="all". \n Please specify either "banner" or "video"`);
+ logWarn(`Adapter e2etest mode: Please make sure your adUnit matches the ${bidderCode}.mode video or banner`);
}
});
}
@@ -528,7 +536,7 @@ function generateServerRequest({payload, requestOptions, bidderRequest}) {
method: 'POST',
data: payload,
options: requestOptions,
- bidderRequest: bidderRequest
+ bidderRequest // Additional data for use in interpretResponse()
};
};
@@ -547,7 +555,7 @@ function createRenderer(bidderRequest, bidResponse) {
}, deepAccess(bidderRequest, 'params.testing.renderer.setTimeout') || DEFAULT_RENDERER_TIMEOUT);
});
} catch (error) {
- logWarn('yahoossp renderer error: setRender() failed', error);
+ logWarn('Renderer error: setRender() failed', error);
}
return renderer;
}
@@ -557,7 +565,7 @@ function createRenderer(bidderRequest, bidResponse) {
export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
- aliases: [],
+ aliases: BIDDER_ALIASES,
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function(bid) {
@@ -570,14 +578,14 @@ export const spec = {
) {
return true;
} else {
- logWarn('yahoossp bidder params missing or incorrect, please pass object with either: dcn & pos OR pubId');
+ logWarn('Bidder params missing or incorrect, please pass object with either: dcn & pos OR pubId');
return false;
}
},
buildRequests: function(validBidRequests, bidderRequest) {
if (isEmpty(validBidRequests) || isEmpty(bidderRequest)) {
- logWarn('yahoossp Adapter: buildRequests called with either empty "validBidRequests" or "bidderRequest"');
+ logWarn('buildRequests called with either empty "validBidRequests" or "bidderRequest"');
return undefined;
};
@@ -592,13 +600,12 @@ export const spec = {
const filteredBidRequests = filterBidRequestByMode(validBidRequests);
- if (config.getConfig('yahoossp.singleRequestMode') === true) {
+ if (getConfigValue(bidderRequest, 'singleRequestMode') === true) {
const payload = generateOpenRtbObject(bidderRequest, filteredBidRequests[0]);
filteredBidRequests.forEach(bid => {
appendImpObject(bid, payload);
});
-
- return generateServerRequest({payload, requestOptions, bidderRequest});
+ return [generateServerRequest({payload, requestOptions, bidderRequest})];
}
return filteredBidRequests.map(bid => {
@@ -608,12 +615,11 @@ export const spec = {
});
},
- interpretResponse: function(serverResponse, { data, bidderRequest }) {
+ interpretResponse: function(serverResponse, { bidderRequest }) {
const response = [];
if (!serverResponse.body || !Array.isArray(serverResponse.body.seatbid)) {
return response;
}
-
let seatbids = serverResponse.body.seatbid;
seatbids.forEach(seatbid => {
let bid;
@@ -628,7 +634,6 @@ export const spec = {
let bidResponse = {
adId: deepAccess(bid, 'adId') ? bid.adId : bid.impid || bid.crid,
- adUnitCode: bidderRequest.adUnitCode,
requestId: bid.impid,
cpm: cpm,
width: bid.w,
diff --git a/modules/yahoosspBidAdapter.md b/modules/yahoosspBidAdapter.md
index 35a640b92b1..c8c42930e5b 100644
--- a/modules/yahoosspBidAdapter.md
+++ b/modules/yahoosspBidAdapter.md
@@ -1,10 +1,10 @@
# Overview
-**Module Name:** yahoossp Bid Adapter
+**Module Name:** Yahoo Advertising Bid Adapter
**Module Type:** Bidder Adapter
**Maintainer:** hb-fe-tech@yahooinc.com
# Description
-The Yahoo SSP Bid Adapter is an OpenRTB interface that consolidates all previous "Oath.inc" adapters such as: "aol", "oneMobile", "oneDisplay" & "oneVideo" supply-side platforms.
+The Yahoo Advertising Bid Adapter is an OpenRTB interface that consolidates all previous "Oath.inc" adapters such as: "aol", "oneMobile", "oneDisplay" & "oneVideo" supply-side platforms.
# Supported Features:
* Media Types: Banner & Video
@@ -21,49 +21,51 @@ The Yahoo SSP Bid Adapter is an OpenRTB interface that consolidates all previous
# Adapter Request mode
-Since the yahoossp adapter now supports both Banner and Video adUnits a controller was needed to allow you to define when the adapter should generate a bid-requests to our Yahoo SSP.
+Since the Yahoo Advertising bid adapter supports both Banner and Video adUnits, a controller was needed to allow you to define when the adapter should generate a bid-requests to the Yahoo bid endpoint.
**Important!** By default the adapter mode is set to "banner" only.
-This means that you do not need to explicitly declare the yahoossp.mode in the Global config to initiate banner adUnit requests.
+This means that you do not need to explicitly declare the `yahooAds.mode` property in the global config to initiate banner adUnit requests.
## Request modes:
* **undefined** - (Default) Will generate bid-requests for "Banner" formats only.
* **banner** - Will generate bid-requests for "Banner" formats only (Explicit declaration).
* **video** - Will generate bid-requests for "Video" formats only (Explicit declaration).
-* **all** - Will generate bid-requests for both "Banner" & "Video" formats
+* **all** - Will generate bid-requests for both "Banner" & "Video" formats.
-**Important!** When setting yahoossp.mode = 'all' Make sure your Yahoo SSP Placement (pos id) supports both Banner & Video placements.
-If it does not, the Yahoo SSP will respond only in the format it is set too.
+**Important!** When setting `yahooAds.mode` to `'all'`, make sure your Yahoo Placement (pos id) supports both Banner & Video placements.
+If it does not, the Yahoo bid server will respond only in the format it is set too.
+### Example: explicitly setting the request mode
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'banner' // 'all', 'video', 'banner' (default)
}
});
```
+
# Integration Options
-The `yahoossp` bid adapter supports 2 types of integration:
+The Yahoo Advertising bid adapter supports 2 types of integration:
1. **dcn & pos** DEFAULT (Site/App & Position targeting) - For Display partners/publishers.
-2. **pubId** (Publisher ID) - For legacy "oneVideo" AND New partners/publishers.
-**Important:** pubId integration (option 2) is only possible when your Seller account is setup for "Inventory Mapping".
+2. **pubId** (Publisher ID) - For legacy "oneVideo" AND new partners/publishers.
+**Important:** pubId integration (option 2) is only possible when your seller account is setup for "Inventory Mapping".
**Please Note:** Most examples in this file are using dcn & pos.
## Who is currently eligible for "pubId" integration
At this time, only the following partners/publishers are eligble for pubId integration:
-1. New partners/publishers that do not have any existing accounts on Yahoo SSP (aka: aol, oneMobile, oneDisplay).
+1. New partners/publishers that do not have an existing account with Yahoo Advertising (aka: aol, oneMobile, oneDisplay).
2. Video SSP (oneVideo) partners/publishers that
A. Do not have any display/banner inventory.
- B. Do not have any existing accounts on Yahoo SSP (aka: aol, oneMobile, oneDisplay).
+ B. Do not have an existing account with Yahoo Advertising (aka: aol, oneMobile, oneDisplay).
# Mandatory Bidder Parameters
## dcn & pos (DEFAULT)
-The minimal requirements for the 'yahoossp' bid adapter to generate an outbound bid-request to our Yahoo SSP are:
+The minimal requirements for the Yahoo Advertising bid adapter to generate an outbound bid-request to Yahoo's bid endpoint are:
1. At least 1 adUnit including mediaTypes: banner or video
2. **bidder.params** object must include:
- A. **dcn:** Yahoo SSP Site/App inventory parameter.
- B. **pos:** Yahoo SSP position inventory parameter.
+ A. **dcn:** Yahoo Advertising Site/App inventory parameter.
+ B. **pos:** Yahoo Advertising position inventory parameter.
### Example: dcn & pos Mandatory Parameters (Single banner adUnit)
```javascript
@@ -76,10 +78,10 @@ const adUnits = [{
},
bids: [
{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from SSP
- pos: '8a969978017a7aaabab4ab0bc01a0009' // Placement ID provided from SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a969978017a7aaabab4ab0bc01a0009' // Placement ID provided by Yahoo Advertising
}
}
]
@@ -87,10 +89,10 @@ const adUnits = [{
```
## pubId
-The minimal requirements for the 'yahoossp' bid adapter to generate an outbound bid-request to our Yahoo SSP are:
+The minimal requirements for the Yahoo Advertising bid adapter to generate an outbound bid-request to Yahoo's bid endpoint are:
1. At least 1 adUnit including mediaTypes: banner or video
2. **bidder.params** object must include:
- A. **pubId:** Yahoo SSP Publisher ID (AKA oneVideo pubId/Exchange name)
+ A. **pubId:** Yahoo Advertising Publisher ID (AKA oneVideo pubId/Exchange name)
### Example: pubId Mandatory Parameters (Single banner adUnit)
```javascript
@@ -103,14 +105,15 @@ const adUnits = [{
},
bids: [
{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- pubId: 'DemoPublisher', // Publisher External ID provided from Yahoo SSP.
+ pubId: 'DemoPublisher', // Publisher defined external ID as configured by Yahoo Advertising.
}
}
]
}];
```
+
# Advanced adUnit Examples:
## Banner
```javascript
@@ -124,21 +127,22 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from Yahoo SSP
- pos: '8a969978017a7aaabab4ab0bc01a0009', // Placement ID provided from Yahoo SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a969978017a7aaabab4ab0bc01a0009', // Placement ID provided by Yahoo Advertising
}
}
}]
}];
```
+
## Video Instream
-**Important!** Make sure that the Yahoo SSP Placement type (in-stream) matches the adUnit video inventory type.
+**Important!** Make sure that the Yahoo Advertising Placement type (in-stream) matches the adUnit video inventory type.
**Note:** Make sure to set the adapter mode to allow video requests by setting it to mode: 'video' OR mode: 'all'.
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'video'
}
});
@@ -156,20 +160,21 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from Yahoo SSP
- pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided from Yahoo SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided by Yahoo Advertising
}
}]
}];
+
```
## Video Outstream
-**Important!** Make sure that the Yahoo SSP Placement type (in-feed/ in-article) matches the adUnit video inventory type.
+**Important!** Make sure that the Yahoo Advertsing placement type (in-feed/ in-article) matches the adUnit video inventory type.
**Note:** Make sure to set the adapter mode to allow video requests by setting it to mode: 'video' OR mode: 'all'
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'video'
}
});
@@ -187,22 +192,22 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from Yahoo SSP
- pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided from Yahoo SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided by Yahoo Advertising
}
}]
}];
+
```
## Multi-Format
-**Important!** If you intend to use the yahoossp bidder for both Banner and Video formats please make sure:
-1. Set the adapter as mode: 'all' - to call the Yahoo SSP for both banner & video formats.
-2. Make sure the Yahoo SSP placement (pos id) supports both banner & video format requests.
-
+**Important!** If you intend to use the Yahoo Advertising bidder for both Banner and Video formats please make sure:
+1. Set the adapter as mode: 'all' - to configure the bid adapter to call the bid endpoint for both banner & video formats.
+2. Make sure the Yahoo Advertising placement (pos id) supports both banner & video format requests.
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'all'
}
});
@@ -223,19 +228,18 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from Yahoo SSP
- pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided from Yahoo SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a96958a017a7a57ac375d50c0c700cc', // Placement ID provided by Yahoo Advertising
}
}]
}];
```
# Optional: Schain module support
-The yahoossp adapter supports the Prebid.org Schain module and will pass it through to our Yahoo SSP
+The Yahoo Advertising bid adapter supports the Prebid.org Schain module and will pass it through to our bid endpoint.
For further details please see, https://docs.prebid.org/dev-docs/modules/schain.html
-
## Global Schain Example:
```javascript
pbjs.setConfig({
@@ -256,7 +260,7 @@ For further details please see, https://docs.prebid.org/dev-docs/modules/schain.
## Bidder Specific Schain Example:
```javascript
pbjs.setBidderConfig({
- "bidders": ['yahoossp'], // can list more bidders here if they share the same config
+ "bidders": ['yahooAds'], // can list more bidders here if they share the same config
"config": {
"schain": {
"validation": "strict",
@@ -275,12 +279,10 @@ For further details please see, https://docs.prebid.org/dev-docs/modules/schain.
```
# Optional: Price floors module & bidfloor
-The yahoossp adapter supports the Prebid.org Price Floors module and will use it to define the outbound bidfloor and currency.
-By default the adapter will always check the existance of Module price floor.
-If a module price floor does not exist you can set a custom bid floor for your impression using "params.bidOverride.imp.bidfloor".
+The Yahoo Advertising bid adapter supports the Prebid.org Price Floors module and will use it to define the outbound bidfloor and currency, if the relevant floors have been defined in the configuration.
+A cusom method for defining bid floors is also supported, this can be enabled by setting the `params.bidOverride.imp.bidfloor` bidder parameter.
**Note:** All override params apply to all requests generated using this configuration regardless of format type.
-
```javascript
const adUnits = [{
code: 'override-pricefloor',
@@ -292,10 +294,10 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
- dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided from Yahoo SSP
- pos: '8a969978017a7aaabab4ab0bc01a0009', // Placement ID provided from Yahoo SSP
+ dcn: '8a969516017a7a396ec539d97f540011', // Site/App ID provided by Yahoo Advertising
+ pos: '8a969978017a7aaabab4ab0bc01a0009', // Placement ID provided by Yahoo Advertising
bidOverride :{
imp: {
bidfloor: 5.00 // bidOverride priceFloor
@@ -310,21 +312,21 @@ const adUnits = [{
For further details please see, https://docs.prebid.org/dev-docs/modules/floors.html
# Optional: Self-served E2E testing mode
-If you want to see how the yahoossp adapter works and loads you are invited to try it out using our testing mode.
+If you want to see how the Yahoo Advertising bid adapter works and loads you are invited to try it out using our testing mode.
This is useful for integration testing and response parsing when checking banner vs video capabilities.
## How to use E2E test mode:
-1. Set the yahoossp global config mode to either 'banner' or 'video' - depending on the adUnit you want to test.
+1. Set the `yahooAds` global config mode to either `'banner'` or `'video'` - depending on the adUnit you want to test.
2. Add params.testing.e2etest: true to your adUnit bidder config - See examples below.
**Note:** When using E2E Test Mode you do not need to pass mandatory bidder params dcn or pos.
-**Important!** E2E Testing Mode only works when the Bidder Request Mode is set explicitly to either 'banner' or 'video'.
+**Important!** E2E Testing Mode only works when the Bidder Request Mode is set explicitly to either `'banner'` or `'video'`.
## Activating E2E Test for "Banner"
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'banner' // select 'banner' or 'video' to define what response to load
}
});
@@ -338,7 +340,7 @@ const adUnits = [{
},
bids: [
{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
testing: {
e2etest: true // Activate E2E Test mode
@@ -353,7 +355,7 @@ const adUnits = [{
**Note:** We recommend using Video Outstream as it would load the video response using our Outstream Renderer feature
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
mode: 'video'
}
});
@@ -371,7 +373,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
testing: {
e2etest: true // Activate E2E Test mode
@@ -382,8 +384,8 @@ const adUnits = [{
```
# Optional: First Party Data
-The yahoossp adapter now supports first party data passed via:
-1. Global ortb2 object using pbjs.setConfig()
+The Yahoo Advertising bid adapter supports first party data passed via:
+1. Global ortb2 object using `pbjs.setConfig()`
2. adUnit ortb2Imp object declared within an adUnit.
For further details please see, https://docs.prebid.org/features/firstPartyData.html
## Global First Party Data "ortb2"
@@ -392,15 +394,15 @@ For further details please see, https://docs.prebid.org/features/firstPartyData.
pbjs.setConfig({
ortb2: {
site: {
- name: 'yahooAdTech',
- domain: 'yahooadtech.com',
+ name: 'Yahoo Advertising',
+ domain: 'yahooadvertising.com',
cat: ['IAB2'],
sectioncat: ['IAB2-2'],
pagecat: ['IAB2-2'],
- page: 'https://page.yahooadtech.com/here.html',
- ref: 'https://ref.yahooadtech.com/there.html',
+ page: 'https://page.yahooadvertising.com.com/here.html',
+ ref: 'https://ref.yahooadvertising.com.com/there.html',
keywords:'yahoo, ad, tech',
- search: 'SSP',
+ search: 'header bidding',
content: {
id: '1234',
title: 'Title',
@@ -521,7 +523,7 @@ pbjs.setConfig({
## AdUnit First Party Data "ortb2Imp"
Most DSPs are adopting the Global Placement ID (GPID).
-Please pass your placement specific GPID value to Yahoo SSP using `adUnit.ortb2Imp.ext.data.pbadslot`.
+Please pass your placement specific GPID value by setting `adUnit.ortb2Imp.ext.data.pbadslot`.
```javascript
const adUnits = [{
code: 'placement',
@@ -541,7 +543,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
pubdId: 'DemoPublisher'
}
@@ -551,7 +553,7 @@ const adUnits = [{
```
# Optional: Bidder bidOverride Parameters
-The yahoossp adapter allows passing override data to the outbound bid-request in that overrides First Party Data.
+The Yahoo Advertising bid adapter allows passing override data to the outbound bid-request that overrides First Party Data.
**Important!** We highly recommend using prebid modules to pass data instead of bidder speicifc overrides.
The use of these parameters are a last resort to force a specific feature or use case in your implementation.
@@ -577,7 +579,6 @@ Currently the bidOverride object only accepts the following:
* device
* ip
-
```javascript
const adUnits = [{
code: 'bidOverride-adUnit',
@@ -590,7 +591,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
dcn: '8a969516017a7a396ec539d97f540011',
pos: '8a96958a017a7a57ac375d50c0c700cc',
@@ -615,7 +616,7 @@ const adUnits = [{
}
},
site: {
- page: 'https://yahoossp-bid-adapter.com',
+ page: 'https://yahooAdvertising-bid-adapter.com',
},
device: {
ip: "1.2.3.4"
@@ -630,7 +631,7 @@ const adUnits = [{
Custom key-value paris can be used for both inventory targeting and reporting.
You must set up key-value pairs in the Yahoo SSP before sending them via the adapter otherwise the Ad Server will not be listening and picking them up.
-Important! Key-value pairs can only contain values of types: String, Number, Array of strings OR Array of numbers
+Important! Key-value pairs can only contain values of the following data types: String, Number, Array of strings OR Array of numbers
```javascript
const adUnits = [{
@@ -644,7 +645,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
dcn: '8a969516017a7a396ec539d97f540011',
pos: '8a96958a017a7a57ac375d50c0c700cc',
@@ -660,14 +661,14 @@ const adUnits = [{
```
# Optional: Custom Cache Time To Live (ttl):
-The yahoossp adapter supports passing of "Time To Live" (ttl) that indicates to prebid chache for how long to keep the chaced winning bid alive. Value is Number in seconds and you can enter any number between 1 - 3600 (seconds).
-The setting can be defined globally using setConfig or within the adUnit.params.
-Global level setConfig overrides adUnit.params.
+The Yahoo Advertising bid adapter supports passing of "Time To Live" (ttl) to indicate to prebid how long the bid response from Yahoo Advertising should be retained by Prebid for. This configuration value must be a Number in seconds, with the valid range being 1 - 3600 inclusive.
+The setting can be defined globally using `setConfig` or within the adUnit.params.
+Global level `setConfig` overrides adUnit.params.
If no value is being passed default is 300 seconds.
## Global TTL
```javascript
pbjs.setConfig({
- yahoossp: {
+ yahooAds: {
ttl: 300
}
});
@@ -683,7 +684,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
dcn: '8a969516017a7a396ec539d97f540011',
pos: '8a96958a017a7a57ac375d50c0c700cc',
@@ -702,7 +703,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
dcn: '8a969516017a7a396ec539d97f540011',
pos: '8a96958a017a7a57ac375d50c0c700cc',
@@ -710,10 +711,11 @@ const adUnits = [{
}
}]
}]
+
```
# Optional: Video Features
## Rewarded video flag
-To indicate to Yahoo SSP that this adUnit is a rewarded video you can pass the following in the params.bidOverride.imp.video.rewarded: 1
+To indicate to Yahoo Advertising that this adUnit is a rewarded video you can set the `params.bidOverride.imp.video.rewarded` property to `1`
```javascript
const adUnits = [{
@@ -727,7 +729,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
dcn: '8a969516017a7a396ec539d97f540011',
pos: '8a96958a017a7a57ac375d50c0c700cc',
@@ -744,7 +746,7 @@ const adUnits = [{
```
## Site/App Targeting for "pubId" Inventory Mapping
-To target your adUnit explicitly to a specific Site/App Object in Yahoo SSP, you can pass one of the following:
+To target your adUnit explicitly to a specific Site/App Object in Yahoo Advertising, you can pass one of the following:
1. params.siteId = External Site ID || Video SSP RTBIS Id (in String format).
2. params.bidOverride.site.id = External Site ID || Video SSP RTBIS Id (in String format).
**Important:** Site override is a only supported when using "pubId" mode.
@@ -762,7 +764,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
pubId: 'DemoPublisher',
siteId: '1234567';
@@ -772,13 +774,13 @@ const adUnits = [{
```
## Placement Targeting for "pubId" Inventory Mapping
-To target your adUnit explicitly to a specific Placement within a Site/App Object in Yahoo SSP, you can pass the following params.placementId = External Placement ID || Placement Alias
+To target your adUnit explicitly to a specific Placement within a Site/App Object in Yahoo Advertising, you can pass the following params.placementId = External Placement ID || Placement Alias
**Important!** Placement override is a only supported when using "pubId" mode.
-**Important!** It is highly recommended that you pass both `siteId` AND `placementId` together to avoid inventory miss matching.
+**Important!** It is highly recommended that you pass both `siteId` AND `placementId` together to avoid inventory mismatching.
### Site & Placement override
-**Important!** If the placement ID does not reside under the defined Site/App object, the request will not resolve and no response will be sent back from the ad-server.
+**Important!** If the placement ID does not reside under the defined Site/App object, the request will not resolve and no response will be sent back from the bid-server.
```javascript
const adUnits = [{
code: 'pubId-site-targeting-adUnit',
@@ -791,7 +793,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
pubId: 'DemoPublisher',
siteId: '1234567',
@@ -801,7 +803,7 @@ const adUnits = [{
}]
```
### Placement only override
-**Important!** Using this method is not advised if you have multiple Site/Apps that are broken out of a Run Of Network (RON) Site/App. If the placement ID does not reside under a matching Site/App object, the request will not resolve and no response will be sent back from the ad-server.
+**Important!** Using this method is not advised if you have multiple Site/Apps that are broken out of a Run Of Network (RON) Site/App. If the placement ID does not reside under a matching Site/App object, the request will not resolve and no response will be sent back from the bid-server.
```javascript
const adUnits = [{
code: 'pubId-site-targeting-adUnit',
@@ -814,7 +816,7 @@ const adUnits = [{
}
},
bids: [{
- bidder: 'yahoossp',
+ bidder: 'yahooAds',
params: {
pubId: 'DemoPublisher',
placementId: 'header-250x300'
@@ -824,9 +826,8 @@ const adUnits = [{
```
# Optional: Legacy override Parameters
-This adapter does not support passing legacy overrides via 'bidder.params.ext' since most of the data should be passed using prebid modules (First Party Data, Schain, Price Floors etc.).
+This adapter does not support passing legacy overrides via `bidder.params.ext` since most of the data should be passed using prebid modules (First Party Data, Schain, Price Floors etc.).
If you do not know how to pass a custom parameter that you previously used, please contact us using the information provided above.
Thank you,
-Yahoo SSP
-
+Yahoo Advertsing
diff --git a/test/spec/modules/yahoosspBidAdapter_spec.js b/test/spec/modules/yahoosspBidAdapter_spec.js
index b0030c89371..c0584173082 100644
--- a/test/spec/modules/yahoosspBidAdapter_spec.js
+++ b/test/spec/modules/yahoosspBidAdapter_spec.js
@@ -3,7 +3,6 @@ import { config } from 'src/config.js';
import { BANNER, VIDEO } from 'src/mediaTypes.js';
import { spec } from 'modules/yahoosspBidAdapter.js';
import {createEidsArray} from '../../../modules/userId/eids';
-import {deepClone} from '../../../src/utils';
const DEFAULT_BID_ID = '84ab500420319d';
const DEFAULT_BID_DCN = '2093845709823475';
@@ -13,18 +12,20 @@ const DEFAULT_AD_UNIT_CODE = '/19968336/header-bid-tag-1';
const DEFAULT_AD_UNIT_TYPE = 'banner';
const DEFAULT_PARAMS_BID_OVERRIDE = {};
const DEFAULT_VIDEO_CONTEXT = 'instream';
-const ADAPTER_VERSION = '1.0.2';
+const ADAPTER_VERSION = '1.1.0';
+const DEFAULT_BIDDER_CODE = 'yahooAds';
+const VALID_BIDDER_CODES = [DEFAULT_BIDDER_CODE, 'yahoossp', 'yahooAdvertising'];
const PREBID_VERSION = '$prebid.version$';
const INTEGRATION_METHOD = 'prebid.js';
// Utility functions
-const generateBidRequest = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
+const generateBidRequest = ({bidderCode, bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
const bidRequest = {
adUnitCode,
auctionId: 'b06c5141-fe8f-4cdf-9d7d-54415490a917',
bidId,
bidderRequestsCount: 1,
- bidder: 'yahoossp',
+ bidder: bidderCode,
bidderRequestId: '7101db09af0db2',
bidderWinsCount: 0,
mediaTypes: {},
@@ -79,7 +80,7 @@ let generateBidderRequest = (bidRequestArray, adUnitCode, ortb2 = {}) => {
adUnitCode: adUnitCode || 'default-adUnitCode',
auctionId: 'd4c83a3b-18e4-4208-b98b-63848449c7aa',
auctionStart: new Date().getTime(),
- bidderCode: 'yahoossp',
+ bidderCode: bidRequestArray[0].bidder,
bidderRequestId: '112f1c7c5d399a',
bids: bidRequestArray,
refererInfo: {
@@ -107,8 +108,9 @@ let generateBidderRequest = (bidRequestArray, adUnitCode, ortb2 = {}) => {
return bidderRequest;
};
-const generateBuildRequestMock = ({bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
+const generateBuildRequestMock = ({bidderCode, bidId, pos, adUnitCode, adUnitType, bidOverrideObject, videoContext, pubIdMode, ortb2}) => {
const bidRequestConfig = {
+ bidderCode: bidderCode || DEFAULT_BIDDER_CODE,
bidId: bidId || DEFAULT_BID_ID,
pos: pos || DEFAULT_BID_POS,
adUnitCode: adUnitCode || DEFAULT_AD_UNIT_CODE,
@@ -174,21 +176,28 @@ const generateResponseMock = (admPayloadType, vastVersion, videoContext) => {
seatbid: [{ bid: [ bidResponse ], seat: 13107 }]
}
};
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: admPayloadType, videoContext: videoContext});
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: admPayloadType, videoContext});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
-
return {serverResponse, data, bidderRequest};
}
// Unit tests
-describe('YahooSSP Bid Adapter:', () => {
+describe('Yahoo Advertising Bid Adapter:', () => {
+ beforeEach(() => {
+ config.resetConfig();
+ });
+
describe('Validate basic properties', () => {
it('should define the correct bidder code', () => {
- expect(spec.code).to.equal('yahoossp')
+ expect(spec.code).to.equal('yahooAds');
+ });
+
+ it('should define the correct bidder aliases', () => {
+ expect(spec.aliases).to.deep.equal(['yahoossp', 'yahooAdvertising']);
});
it('should define the correct vendor ID', () => {
- expect(spec.gvlid).to.equal(25)
+ expect(spec.gvlid).to.equal(25);
});
});
@@ -271,33 +280,62 @@ describe('YahooSSP Bid Adapter:', () => {
});
describe('user consent parameters are updated', () => {
- let syncOptions = {
+ const syncOptions = {
iframeEnabled: true,
pixelEnabled: true
};
- let pixelObjects = spec.getUserSyncs(
- syncOptions,
- SERVER_RESPONSES,
- bidderRequest.gdprConsent,
- bidderRequest.uspConsent,
- bidderRequest.gppConsent
- );
- pixelObjects.forEach(pixelObject => {
- let url = pixelObject.url;
- let urlParams = new URL(url).searchParams;
- const expectedParams = {
- 'baz': 'true',
- 'gdpr_consent': bidderRequest.gdprConsent.consentString,
- 'gdpr': bidderRequest.gdprConsent.gdprApplies ? '1' : '0',
- 'us_privacy': bidderRequest.uspConsent,
- 'gpp': bidderRequest.gppConsent.gppString,
- 'gpp_sid': Array.isArray(bidderRequest.gppConsent.applicableSections) ? bidderRequest.gppConsent.applicableSections.join(',') : ''
- }
- for (const [key, value] of Object.entries(expectedParams)) {
- it(`Updates the ${key} consent param in user sync URL ${url}`, () => {
- expect(urlParams.get(key)).to.equal(value);
- });
- };
+ describe('when all consent data is set', () => {
+ const pixelObjects = spec.getUserSyncs(
+ syncOptions,
+ SERVER_RESPONSES,
+ bidderRequest.gdprConsent,
+ bidderRequest.uspConsent,
+ bidderRequest.gppConsent
+ );
+ pixelObjects.forEach(pixelObject => {
+ let url = pixelObject.url;
+ let urlParams = new URL(url).searchParams;
+ const expectedParams = {
+ 'baz': 'true',
+ 'gdpr_consent': bidderRequest.gdprConsent.consentString,
+ 'gdpr': bidderRequest.gdprConsent.gdprApplies ? '1' : '0',
+ 'us_privacy': bidderRequest.uspConsent,
+ 'gpp': bidderRequest.gppConsent.gppString,
+ 'gpp_sid': Array.isArray(bidderRequest.gppConsent.applicableSections) ? bidderRequest.gppConsent.applicableSections.join(',') : ''
+ }
+ for (const [key, value] of Object.entries(expectedParams)) {
+ it(`Updates the ${key} consent param in user sync URL ${url}`, () => {
+ expect(urlParams.get(key)).to.equal(value);
+ });
+ };
+ });
+ });
+
+ describe('when no consent data is set', () => {
+ const pixelObjects = spec.getUserSyncs(
+ syncOptions,
+ SERVER_RESPONSES,
+ undefined,
+ undefined,
+ undefined
+ );
+ pixelObjects.forEach(pixelObject => {
+ let url = pixelObject.url;
+ let urlParams = new URL(url).searchParams;
+ const expectedParams = {
+ 'baz': 'true',
+ 'gdpr_consent': '',
+ 'gdpr': '0',
+ 'us_privacy': '',
+ 'gpp': '',
+ 'gpp_sid': ''
+ }
+ for (const [key, value] of Object.entries(expectedParams)) {
+ it(`Updates the ${key} consent param in user sync URL ${url}`, () => {
+ expect(urlParams.get(key)).to.equal(value);
+ });
+ };
+ });
});
});
});
@@ -647,9 +685,9 @@ describe('YahooSSP Bid Adapter:', () => {
};
const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.user[param]).to.be.a('object');
- expect(data.user[param]).to.be.deep.include({[param]: {a: '123', b: '456'}});
- config.setConfig({ortb2: {}});
+ const user = data.user;
+ expect(user[param]).to.be.a('object');
+ expect(user[param]).to.be.deep.include({[param]: {a: '123', b: '456'}});
});
});
@@ -669,12 +707,14 @@ describe('YahooSSP Bid Adapter:', () => {
};
const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.user.data[0][param]).to.exist;
- expect(data.user.data[0][param]).to.be.a('string');
- expect(data.user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
- expect(data.site.content.data[0][param]).to.exist;
- expect(data.site.content.data[0][param]).to.be.a('string');
- expect(data.site.content.data[0][param]).to.be.equal(ortb2.site.content.data[0][param]);
+ const user = data.user;
+ const site = data.site;
+ expect(user.data[0][param]).to.exist;
+ expect(user.data[0][param]).to.be.a('string');
+ expect(user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
+ expect(site.content.data[0][param]).to.exist;
+ expect(site.content.data[0][param]).to.be.a('string');
+ expect(site.content.data[0][param]).to.be.equal(ortb2.site.content.data[0][param]);
});
});
@@ -688,9 +728,10 @@ describe('YahooSSP Bid Adapter:', () => {
};
const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.user.data[0][param]).to.exist;
- expect(data.user.data[0][param]).to.be.a('array');
- expect(data.user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
+ const user = data.user;
+ expect(user.data[0][param]).to.exist;
+ expect(user.data[0][param]).to.be.a('array');
+ expect(user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
});
});
@@ -704,10 +745,10 @@ describe('YahooSSP Bid Adapter:', () => {
};
const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.user.data[0][param]).to.exist;
- expect(data.user.data[0][param]).to.be.a('object');
- expect(data.user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
- config.setConfig({ortb2: {}});
+ const user = data.user;
+ expect(user.data[0][param]).to.exist;
+ expect(user.data[0][param]).to.be.a('object');
+ expect(user.data[0][param]).to.be.equal(ortb2.user.data[0][param]);
});
});
@@ -815,26 +856,33 @@ describe('YahooSSP Bid Adapter:', () => {
});
describe('Endpoint & Impression Request Mode:', () => {
- it('should route request to config override endpoint', () => {
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
- const testOverrideEndpoint = 'http://foo.bar.baz.com/bidderRequest';
+ afterEach(() => {
config.setConfig({
- yahoossp: {
- endpoint: testOverrideEndpoint
+ yahooAds: {
+ singleRequestMode: undefined
}
});
- const response = spec.buildRequests(validBidRequests, bidderRequest)[0];
- expect(response).to.deep.include(
- {
- method: 'POST',
- url: testOverrideEndpoint
- });
});
- it('should route request to /bidRequest endpoint when dcn & pos present', () => {
- config.setConfig({
- yahoossp: {}
+ VALID_BIDDER_CODES.forEach(bidderCode => {
+ it(`should route request to config override endpoint for ${bidderCode} override config`, () => {
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode});
+ const testOverrideEndpoint = 'http://foo.bar.baz.com/bidderRequest';
+ const cfg = {};
+ cfg[bidderCode] = {
+ endpoint: testOverrideEndpoint
+ };
+ config.setConfig(cfg);
+ const response = spec.buildRequests(validBidRequests, bidderRequest)[0];
+ expect(response).to.deep.include(
+ {
+ method: 'POST',
+ url: testOverrideEndpoint
+ });
});
+ });
+
+ it('should route request to /bidRequest endpoint when dcn & pos present', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
const response = spec.buildRequests(validBidRequests, bidderRequest);
expect(response[0]).to.deep.include({
@@ -862,15 +910,15 @@ describe('YahooSSP Bid Adapter:', () => {
bidderRequest.bids = validBidRequests;
config.setConfig({
- yahoossp: {
+ yahooAds: {
singleRequestMode: true
}
});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
- expect(data.imp).to.be.an('array').with.lengthOf(2);
+ const responsePayload = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(responsePayload.imp).to.be.an('array').with.lengthOf(2);
- expect(data.imp[0]).to.deep.include({
+ expect(responsePayload.imp[0]).to.deep.include({
id: DEFAULT_BID_ID,
ext: {
pos: DEFAULT_BID_POS,
@@ -878,7 +926,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
});
- expect(data.imp[1]).to.deep.include({
+ expect(responsePayload.imp[1]).to.deep.include({
id: BID_ID_2,
ext: {
pos: BID_POS_2,
@@ -896,8 +944,9 @@ describe('YahooSSP Bid Adapter:', () => {
it('buildRequests(): should return an array with the correct amount of request objects', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
- const response = spec.buildRequests(validBidRequests, bidderRequest).bidderRequest;
- expect(response.bids).to.be.an('array').to.have.lengthOf(1);
+ const reqs = spec.buildRequests(validBidRequests, bidderRequest);
+ expect(reqs).to.be.an('array').to.have.lengthOf(1);
+ expect(reqs[0]).to.be.an('object').that.has.keys('method', 'url', 'data', 'options', 'bidderRequest');
});
});
@@ -905,7 +954,7 @@ describe('YahooSSP Bid Adapter:', () => {
it('should return request objects with the relevant custom headers and content type declaration', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
bidderRequest.gdprConsent.gdprApplies = false;
- const options = spec.buildRequests(validBidRequests, bidderRequest).options;
+ const options = spec.buildRequests(validBidRequests, bidderRequest)[0].options;
expect(options).to.deep.equal(
{
contentType: 'application/json',
@@ -921,6 +970,7 @@ describe('YahooSSP Bid Adapter:', () => {
it('should set the allowed sources user eids', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
validBidRequests[0].userIdAsEids = createEidsArray({
+ connectId: 'connectId_FROM_USER_ID_MODULE',
admixerId: 'admixerId_FROM_USER_ID_MODULE',
adtelligentId: 'adtelligentId_FROM_USER_ID_MODULE',
amxId: 'amxId_FROM_USER_ID_MODULE',
@@ -933,9 +983,10 @@ describe('YahooSSP Bid Adapter:', () => {
criteoId: 'criteoId_FROM_USER_ID_MODULE',
fabrickId: 'fabrickId_FROM_USER_ID_MODULE',
});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user.ext.eids).to.deep.equal([
+ {source: 'yahoo.com', uids: [{id: 'connectId_FROM_USER_ID_MODULE', atype: 3}]},
{source: 'admixer.net', uids: [{id: 'admixerId_FROM_USER_ID_MODULE', atype: 3}]},
{source: 'adtelligent.com', uids: [{id: 'adtelligentId_FROM_USER_ID_MODULE', atype: 3}]},
{source: 'amxdt.net', uids: [{id: 'amxId_FROM_USER_ID_MODULE', atype: 1}]},
@@ -955,7 +1006,7 @@ describe('YahooSSP Bid Adapter:', () => {
validBidRequests[0].userIdAsEids = createEidsArray({
justId: 'justId_FROM_USER_ID_MODULE'
});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.user.ext.eids).to.deep.equal([]);
});
@@ -964,7 +1015,7 @@ describe('YahooSSP Bid Adapter:', () => {
describe('Request Payload oRTB bid validation:', () => {
it('should generate a valid openRTB bid-request object in the data field', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site).to.deep.equal({
id: bidderRequest.bids[0].params.dcn,
page: bidderRequest.refererInfo.page
@@ -1013,7 +1064,7 @@ describe('YahooSSP Bid Adapter:', () => {
it('should generate a valid openRTB imp.ext object in the bid-request', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
const bid = validBidRequests[0];
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].ext).to.deep.equal({
pos: bid.params.pos,
dfp_ad_unit_code: DEFAULT_AD_UNIT_CODE
@@ -1023,7 +1074,7 @@ describe('YahooSSP Bid Adapter:', () => {
it('should use siteId value as site.id in the outbound bid-request when using "pubId" integration mode', () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true});
validBidRequests[0].params.siteId = '1234567';
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.id).to.equal('1234567');
});
@@ -1039,7 +1090,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
let { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.publisher).to.deep.equal({
ext: {
publisherblob: 'pblob',
@@ -1060,7 +1111,7 @@ describe('YahooSSP Bid Adapter:', () => {
}
}
let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true, ortb2});
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.site.publisher).to.deep.equal({
id: DEFAULT_PUBID,
ext: {
@@ -1073,17 +1124,13 @@ describe('YahooSSP Bid Adapter:', () => {
it('should use placementId value as imp.tagid in the outbound bid-request when using "pubId" integration mode', () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true});
validBidRequests[0].params.placementId = 'header-300x250';
- const data = spec.buildRequests(validBidRequests, bidderRequest).data;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].tagid).to.deep.equal('header-300x250');
});
});
describe('Request Payload oRTB bid.imp validation:', () => {
- // Validate Banner imp imp when yahoossp.mode=undefined
- it('should generate a valid "Banner" imp object', () => {
- config.setConfig({
- yahoossp: {}
- });
+ it('should generate a valid "Banner" imp object when mode config override is undefined', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].video).to.not.exist;
@@ -1093,74 +1140,82 @@ describe('YahooSSP Bid Adapter:', () => {
});
});
- // Validate Banner imp when yahoossp.mode="banner"
- it('should generate a valid "Banner" imp object', () => {
- config.setConfig({
- yahoossp: { mode: 'banner' }
- });
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.imp[0].video).to.not.exist;
- expect(data.imp[0].banner).to.deep.equal({
- mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
- format: [{w: 300, h: 250}, {w: 300, h: 600}]
+ // Validate Banner imp when config value for mode="banner"
+ VALID_BIDDER_CODES.forEach(bidderCode => {
+ it(`should generate a valid "Banner" imp object for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: BANNER
+ };
+ config.setConfig(cfg);
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode});
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.imp[0].video).to.not.exist;
+ expect(data.imp[0].banner).to.deep.equal({
+ mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
+ format: [{w: 300, h: 250}, {w: 300, h: 600}]
+ });
});
- });
- // Validate Video imp
- it('should generate a valid "Video" only imp object', () => {
- config.setConfig({
- yahoossp: { mode: 'video' }
- });
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: 'video'});
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.imp[0].banner).to.not.exist;
- expect(data.imp[0].video).to.deep.equal({
- mimes: ['video/mp4', 'application/javascript'],
- w: 300,
- h: 250,
- api: [2],
- protocols: [2, 5],
- startdelay: 0,
- linearity: 1,
- maxbitrate: undefined,
- maxduration: undefined,
- minduration: undefined,
- delivery: undefined,
- pos: undefined,
- playbackmethod: undefined,
- rewarded: undefined,
- placement: undefined
+ // Validate Video imp
+ it(`should generate a valid "Video" only imp object for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: VIDEO
+ };
+ config.setConfig(cfg);
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode, adUnitType: 'video'});
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.imp[0].banner).to.not.exist;
+ expect(data.imp[0].video).to.deep.equal({
+ mimes: ['video/mp4', 'application/javascript'],
+ w: 300,
+ h: 250,
+ api: [2],
+ protocols: [2, 5],
+ startdelay: 0,
+ linearity: 1,
+ maxbitrate: undefined,
+ maxduration: undefined,
+ minduration: undefined,
+ delivery: undefined,
+ pos: undefined,
+ playbackmethod: undefined,
+ rewarded: undefined,
+ placement: undefined
+ });
});
- });
- // Validate multi-format Video+banner imp
- it('should generate a valid multi-format "Video + Banner" imp object', () => {
- config.setConfig({
- yahoossp: { mode: 'all' }
- });
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: 'multi-format'});
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.imp[0].banner).to.deep.equal({
- mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
- format: [{w: 300, h: 250}, {w: 300, h: 600}]
- });
- expect(data.imp[0].video).to.deep.equal({
- mimes: ['video/mp4', 'application/javascript'],
- w: 300,
- h: 250,
- api: [2],
- protocols: [2, 5],
- startdelay: 0,
- linearity: 1,
- maxbitrate: undefined,
- maxduration: undefined,
- minduration: undefined,
- delivery: undefined,
- pos: undefined,
- playbackmethod: undefined,
- rewarded: undefined,
- placement: undefined
+ // Validate multi-format Video+banner imp
+ it(`should generate a valid multi-format "Video + Banner" imp object for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: 'all'
+ };
+ config.setConfig(cfg);
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode, adUnitType: 'multi-format'});
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.imp[0].banner).to.deep.equal({
+ mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
+ format: [{w: 300, h: 250}, {w: 300, h: 600}]
+ });
+ expect(data.imp[0].video).to.deep.equal({
+ mimes: ['video/mp4', 'application/javascript'],
+ w: 300,
+ h: 250,
+ api: [2],
+ protocols: [2, 5],
+ startdelay: 0,
+ linearity: 1,
+ maxbitrate: undefined,
+ maxduration: undefined,
+ minduration: undefined,
+ delivery: undefined,
+ pos: undefined,
+ playbackmethod: undefined,
+ rewarded: undefined,
+ placement: undefined
+ });
});
});
@@ -1179,7 +1234,6 @@ describe('YahooSSP Bid Adapter:', () => {
invalidKey5: undefined
};
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
-
expect(data.imp[0].ext.kvs).to.deep.equal({
key1: 'String',
key2: 123456,
@@ -1192,10 +1246,6 @@ describe('YahooSSP Bid Adapter:', () => {
describe('Multiple adUnit validations:', () => {
// Multiple banner adUnits
it('should generate multiple bid-requests for each adUnit - 2 banner only', () => {
- config.setConfig({
- yahoossp: { mode: 'banner' }
- });
-
const BID_ID_2 = '84ab50xxxxx';
const BID_POS_2 = 'footer';
const AD_UNIT_CODE_2 = 'test-ad-unit-code-123';
@@ -1209,12 +1259,12 @@ describe('YahooSSP Bid Adapter:', () => {
validBidRequests = [bidRequest, bidRequest2, bidRequest3];
bidderRequest.bids = validBidRequests;
- const response = spec.buildRequests(validBidRequests, bidderRequest)
- expect(response).to.be.a('array');
- expect(response.length).to.equal(2);
- response.forEach((obj) => {
- expect(obj.data.imp[0].video).to.not.exist
- expect(obj.data.imp[0].banner).to.deep.equal({
+ const reqs = spec.buildRequests(validBidRequests, bidderRequest)
+ expect(reqs).to.be.a('array');
+ expect(reqs.length).to.equal(2);
+ reqs.forEach(req => {
+ expect(req.data.imp[0].video).to.not.exist
+ expect(req.data.imp[0].banner).to.deep.equal({
mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
format: [{w: 300, h: 250}, {w: 300, h: 600}]
});
@@ -1223,9 +1273,11 @@ describe('YahooSSP Bid Adapter:', () => {
// Multiple video adUnits
it('should generate multiple bid-requests for each adUnit - 2 video only', () => {
- config.setConfig({
- yahoossp: { mode: 'video' }
- });
+ const cfg = {};
+ cfg[DEFAULT_BIDDER_CODE] = {
+ mode: VIDEO
+ };
+ config.setConfig(cfg);
const BID_ID_2 = '84ab50xxxxx';
const BID_POS_2 = 'footer';
const AD_UNIT_CODE_2 = 'test-ad-unit-code-123';
@@ -1233,18 +1285,18 @@ describe('YahooSSP Bid Adapter:', () => {
const BID_POS_3 = 'hero';
const AD_UNIT_CODE_3 = 'video-ad-unit';
- let { bidRequest, validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: 'video'}); // video
- const { bidRequest: bidRequest2 } = generateBuildRequestMock({bidId: BID_ID_2, pos: BID_POS_2, adUnitCode: AD_UNIT_CODE_2, adUnitType: 'video'}); // video
- const { bidRequest: bidRequest3 } = generateBuildRequestMock({bidId: BID_ID_3, pos: BID_POS_3, adUnitCode: AD_UNIT_CODE_3}); // banner (should be filtered)
+ let {bidRequest, validBidRequests, bidderRequest} = generateBuildRequestMock({adUnitType: 'video'}); // video
+ const {bidRequest: bidRequest2} = generateBuildRequestMock({bidId: BID_ID_2, pos: BID_POS_2, adUnitCode: AD_UNIT_CODE_2, adUnitType: 'video'}); // video
+ const {bidRequest: bidRequest3} = generateBuildRequestMock({bidId: BID_ID_3, pos: BID_POS_3, adUnitCode: AD_UNIT_CODE_3}); // banner (should be filtered)
validBidRequests = [bidRequest, bidRequest2, bidRequest3];
bidderRequest.bids = validBidRequests;
- const response = spec.buildRequests(validBidRequests, bidderRequest)
- expect(response).to.be.a('array');
- expect(response.length).to.equal(2);
- response.forEach((obj) => {
- expect(obj.data.imp[0].banner).to.not.exist
- expect(obj.data.imp[0].video).to.deep.equal({
+ const reqs = spec.buildRequests(validBidRequests, bidderRequest)
+ expect(reqs).to.be.a('array');
+ expect(reqs.length).to.equal(2);
+ reqs.forEach(req => {
+ expect(req.data.imp[0].banner).to.not.exist
+ expect(req.data.imp[0].video).to.deep.equal({
mimes: ['video/mp4', 'application/javascript'],
w: 300,
h: 250,
@@ -1265,9 +1317,9 @@ describe('YahooSSP Bid Adapter:', () => {
});
// Mixed adUnits 1-banner, 1-video, 1-native (should filter out native)
it('should generate multiple bid-requests for both "video & banner" adUnits', () => {
- config.setConfig({
- yahoossp: { mode: 'all' }
- });
+ const cfg = {};
+ cfg[DEFAULT_BIDDER_CODE] = { mode: 'all' };
+ config.setConfig(cfg);
const BID_ID_2 = '84ab50xxxxx';
const BID_POS_2 = 'footer';
const AD_UNIT_CODE_2 = 'video-ad-unit';
@@ -1281,21 +1333,21 @@ describe('YahooSSP Bid Adapter:', () => {
validBidRequests = [bidRequest, bidRequest2, bidRequest3];
bidderRequest.bids = validBidRequests;
- const response = spec.buildRequests(validBidRequests, bidderRequest);
- expect(response).to.be.a('array');
- expect(response.length).to.equal(2);
- response.forEach((obj) => {
- expect(obj.data.imp[0].native).to.not.exist;
+ const reqs = spec.buildRequests(validBidRequests, bidderRequest);
+ expect(reqs).to.be.a('array');
+ expect(reqs.length).to.equal(2);
+ reqs.forEach(req => {
+ expect(req.data.imp[0].native).to.not.exist;
});
- const data1 = response[0].data;
+ const data1 = reqs[0].data;
expect(data1.imp[0].video).to.not.exist;
expect(data1.imp[0].banner).to.deep.equal({
mimes: ['text/html', 'text/javascript', 'application/javascript', 'image/jpg'],
format: [{w: 300, h: 250}, {w: 300, h: 600}]
});
- const data2 = response[1].data;
+ const data2 = reqs[1].data;
expect(data2.imp[0].banner).to.not.exist;
expect(data2.imp[0].video).to.deep.equal({
mimes: ['video/mp4', 'application/javascript'],
@@ -1318,90 +1370,98 @@ describe('YahooSSP Bid Adapter:', () => {
});
describe('Video params firstlook & bidOverride validations:', () => {
- it('should first look at params.bidOverride for video placement data', () => {
- config.setConfig({
- yahoossp: { mode: 'video' }
- });
- const bidOverride = {
- imp: {
- video: {
- mimes: ['video/mp4'],
- w: 400,
- h: 350,
- api: [1],
- protocols: [1, 3],
- startdelay: 0,
- linearity: 1,
- maxbitrate: 400000,
- maxduration: 3600,
- minduration: 1500,
- delivery: 1,
- pos: 123456,
- playbackmethod: 1,
- rewarded: 1,
- placement: 1
+ VALID_BIDDER_CODES.forEach(bidderCode => {
+ it(`should first look at params.bidOverride for video placement data for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: VIDEO
+ };
+ config.setConfig(cfg);
+ const bidOverride = {
+ imp: {
+ video: {
+ mimes: ['video/mp4'],
+ w: 400,
+ h: 350,
+ api: [1],
+ protocols: [1, 3],
+ startdelay: 0,
+ linearity: 1,
+ maxbitrate: 400000,
+ maxduration: 3600,
+ minduration: 1500,
+ delivery: 1,
+ pos: 123456,
+ playbackmethod: 1,
+ rewarded: 1,
+ placement: 1
+ }
}
}
- }
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: 'video', bidOverrideObject: bidOverride});
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.imp[0].video).to.deep.equal(bidOverride.imp.video);
- });
-
- it('should second look at bid.mediaTypes.video for video placement data', () => {
- config.setConfig({
- yahoossp: { mode: 'video' }
- });
- let { bidRequest, bidderRequest } = generateBuildRequestMock({adUnitType: 'video'});
- bidRequest.mediaTypes.video = {
- mimes: ['video/mp4'],
- playerSize: [400, 350],
- api: [1],
- protocols: [1, 3],
- startdelay: 0,
- linearity: 1,
- maxbitrate: 400000,
- maxduration: 3600,
- minduration: 1500,
- delivery: 1,
- pos: 123456,
- playbackmethod: 1,
- placement: 1
- }
- const validBidRequests = [bidRequest];
- bidderRequest.bids = validBidRequests;
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.imp[0].video).to.deep.equal({
- mimes: ['video/mp4'],
- w: 400,
- h: 350,
- api: [1],
- protocols: [1, 3],
- startdelay: 0,
- linearity: 1,
- maxbitrate: 400000,
- maxduration: 3600,
- minduration: 1500,
- delivery: 1,
- pos: 123456,
- playbackmethod: 1,
- placement: 1,
- rewarded: undefined
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode, adUnitType: 'video', bidOverrideObject: bidOverride});
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.imp[0].video).to.deep.equal(bidOverride.imp.video);
});
- });
- it('should use params.bidOverride.device.ip override', () => {
- config.setConfig({
- yahoossp: { mode: 'all' }
+ it(`should second look at bid.mediaTypes.video for video placement data for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: VIDEO
+ };
+ config.setConfig(cfg);
+ let { bidRequest, bidderRequest } = generateBuildRequestMock({bidderCode, adUnitType: 'video'});
+ bidRequest.mediaTypes.video = {
+ mimes: ['video/mp4'],
+ playerSize: [400, 350],
+ api: [1],
+ protocols: [1, 3],
+ startdelay: 0,
+ linearity: 1,
+ maxbitrate: 400000,
+ maxduration: 3600,
+ minduration: 1500,
+ delivery: 1,
+ pos: 123456,
+ playbackmethod: 1,
+ placement: 1
+ }
+ const validBidRequests = [bidRequest];
+ bidderRequest.bids = validBidRequests;
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.imp[0].video).to.deep.equal({
+ mimes: ['video/mp4'],
+ w: 400,
+ h: 350,
+ api: [1],
+ protocols: [1, 3],
+ startdelay: 0,
+ linearity: 1,
+ maxbitrate: 400000,
+ maxduration: 3600,
+ minduration: 1500,
+ delivery: 1,
+ pos: 123456,
+ playbackmethod: 1,
+ placement: 1,
+ rewarded: undefined
+ });
});
- const bidOverride = {
- device: {
- ip: '1.2.3.4'
+
+ it(`should use params.bidOverride.device.ip override for ${bidderCode} config override`, () => {
+ const cfg = {};
+ cfg[bidderCode] = {
+ mode: 'all'
+ };
+ config.setConfig(cfg);
+ const bidOverride = {
+ device: {
+ ip: '1.2.3.4'
+ }
}
- }
- const { validBidRequests, bidderRequest } = generateBuildRequestMock({adUnitType: 'video', bidOverrideObject: bidOverride});
- const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
- expect(data.device.ip).to.deep.equal(bidOverride.device.ip);
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({bidderCode, adUnitType: 'video', bidOverrideObject: bidOverride});
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
+ expect(data.device.ip).to.deep.equal(bidOverride.device.ip);
+ });
});
});
// #endregion buildRequests():
@@ -1417,6 +1477,22 @@ describe('YahooSSP Bid Adapter:', () => {
});
describe('for mediaTypes: "video"', () => {
+ beforeEach(() => {
+ config.setConfig({
+ yahooAds: {
+ mode: VIDEO
+ }
+ });
+ });
+
+ afterEach(() => {
+ config.setConfig({
+ yahooAds: {
+ mode: undefined
+ }
+ });
+ });
+
it('should insert video VPAID payload into vastXml', () => {
const { serverResponse, bidderRequest } = generateResponseMock('video');
const response = spec.interpretResponse(serverResponse, {bidderRequest});
@@ -1434,28 +1510,38 @@ describe('YahooSSP Bid Adapter:', () => {
expect(response[0].mediaType).to.equal('video');
})
- it('should insert video DAP O2 Player into ad', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('dap-o2', 'vpaid');
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ad).to.equal('');
- expect(response[0].vastUrl).to.be.undefined;
- expect(response[0].vastXml).to.be.undefined;
- expect(response[0].mediaType).to.equal('banner');
- });
+ describe('wrapped in video players for display inventory', () => {
+ beforeEach(() => {
+ config.setConfig({
+ yahooAds: {
+ mode: undefined
+ }
+ });
+ });
- it('should insert video DAP Unified Player into ad', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('dap-up', 'vpaid');
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ad).to.equal('');
- expect(response[0].vastUrl).to.be.undefined;
- expect(response[0].vastXml).to.be.undefined;
- expect(response[0].mediaType).to.equal('banner');
- })
+ it('should insert video DAP O2 Player into ad', () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('dap-o2', 'vpaid');
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ad).to.equal('');
+ expect(response[0].vastUrl).to.be.undefined;
+ expect(response[0].vastXml).to.be.undefined;
+ expect(response[0].mediaType).to.equal('banner');
+ });
+
+ it('should insert video DAP Unified Player into ad', () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('dap-up', 'vpaid');
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ad).to.equal('');
+ expect(response[0].vastUrl).to.be.undefined;
+ expect(response[0].vastXml).to.be.undefined;
+ expect(response[0].mediaType).to.equal('banner');
+ })
+ });
});
describe('Support Advertiser domains', () => {
it('should append bid-response adomain to meta.advertiserDomains', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('video', 'vpaid');
+ const { serverResponse, bidderRequest } = generateResponseMock('banner');
const response = spec.interpretResponse(serverResponse, {bidderRequest});
expect(response[0].meta.advertiserDomains).to.be.a('array');
expect(response[0].meta.advertiserDomains[0]).to.equal('advertiser-domain.com');
@@ -1490,53 +1576,55 @@ describe('YahooSSP Bid Adapter:', () => {
});
describe('Time To Live (ttl)', () => {
- const UNSUPPORTED_TTL_FORMATS = ['string', [1, 2, 3], true, false, null, undefined];
- UNSUPPORTED_TTL_FORMATS.forEach(param => {
- it('should not allow unsupported global yahoossp.ttl formats and default to 300', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('banner');
- config.setConfig({
- yahoossp: { ttl: param }
+ VALID_BIDDER_CODES.forEach(bidderCode => {
+ const UNSUPPORTED_TTL_FORMATS = ['string', [1, 2, 3], true, false, null, undefined];
+ UNSUPPORTED_TTL_FORMATS.forEach(param => {
+ it(`should not allow unsupported global ${bidderCode}.ttl formats and default to 300`, () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('banner');
+ const cfg = {};
+ cfg['yahooAds'] = { ttl: param };
+ config.setConfig(cfg);
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ttl).to.equal(300);
});
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ttl).to.equal(300);
- });
- it('should not allow unsupported params.ttl formats and default to 300', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('banner');
- bidderRequest.bids[0].params.ttl = param;
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ttl).to.equal(300);
+ it('should not allow unsupported params.ttl formats and default to 300', () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('banner');
+ bidderRequest.bids[0].params.ttl = param;
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ttl).to.equal(300);
+ });
});
- });
- const UNSUPPORTED_TTL_VALUES = [-1, 3601];
- UNSUPPORTED_TTL_VALUES.forEach(param => {
- it('should not allow invalid global yahoossp.ttl values 3600 < ttl < 0 and default to 300', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('banner');
- config.setConfig({
- yahoossp: { ttl: param }
+ const UNSUPPORTED_TTL_VALUES = [-1, 3601];
+ UNSUPPORTED_TTL_VALUES.forEach(param => {
+ it('should not allow invalid global config ttl values 3600 < ttl < 0 and default to 300', () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('banner');
+ config.setConfig({
+ yahooAds: { ttl: param }
+ });
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ttl).to.equal(300);
+ });
+
+ it('should not allow invalid params.ttl values 3600 < ttl < 0 and default to 300', () => {
+ const { serverResponse, bidderRequest } = generateResponseMock('banner');
+ bidderRequest.bids[0].params.ttl = param;
+ const response = spec.interpretResponse(serverResponse, {bidderRequest});
+ expect(response[0].ttl).to.equal(300);
});
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ttl).to.equal(300);
});
- it('should not allow invalid params.ttl values 3600 < ttl < 0 and default to 300', () => {
+ it('should give presedence to Gloabl ttl over params.ttl ', () => {
const { serverResponse, bidderRequest } = generateResponseMock('banner');
- bidderRequest.bids[0].params.ttl = param;
+ config.setConfig({
+ yahooAds: { ttl: 500 }
+ });
+ bidderRequest.bids[0].params.ttl = 400;
const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ttl).to.equal(300);
+ expect(response[0].ttl).to.equal(500);
});
});
-
- it('should give presedence to Gloabl ttl over params.ttl ', () => {
- const { serverResponse, bidderRequest } = generateResponseMock('banner');
- config.setConfig({
- yahoossp: { ttl: 500 }
- });
- bidderRequest.bids[0].params.ttl = 400;
- const response = spec.interpretResponse(serverResponse, {bidderRequest});
- expect(response[0].ttl).to.equal(500);
- });
});
describe('Aliasing support', () => {