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

Merge from upstream #1

Merged
merged 28 commits into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0ab545e
Prebid 0.30.0 Release
jaiminpanchal27 Oct 3, 2017
0bc0b29
Increment pre version
jaiminpanchal27 Oct 3, 2017
42282f5
prebidAdapter secure support (#1655)
bretg Oct 6, 2017
6186a2c
Aliasbidder fix (#1652)
jaiminpanchal27 Oct 6, 2017
a9dda35
fixes bug for IE when invalid value passed to parse (#1657)
jaiminpanchal27 Oct 6, 2017
a2db7c4
Remove undefined variable usage (#1662)
matthewlane Oct 6, 2017
731c7e4
Prebid 0.30.1 Release
jaiminpanchal27 Oct 6, 2017
a907a4a
remove bidmanager from rubicon tests (#1671)
snapwich Oct 11, 2017
f40f0e3
no longer attaching gpt slots to adUnits, which breaks utils.cloneJso…
harpere Oct 12, 2017
2988065
Fix adapter tests that hardcoded pbjs. (#1666)
mattpr Oct 13, 2017
2f58bb0
Fix broken AOL mobile endpoint secure bid requests (#1684)
kizzard Oct 13, 2017
fc9cbfb
Update spotx video adapter to set the spotx_ad_key used in DFP (#1614)
npeceniak Oct 13, 2017
4eff79f
PulsePoint Lite adapter - Enabling Sync pixel (#1686)
anand-venkatraman Oct 16, 2017
e1f2d08
Code improvement for trustx adapter (#1673)
PWyrembak Oct 16, 2017
a20c3f8
Change Default Content-Type for POST Requests to 'application/json' (…
Oct 16, 2017
3f8021c
AppnexusAst bidadapter markdown file (#1696)
jaiminpanchal27 Oct 16, 2017
209921c
AppnexusAst adapter: logging error message from endpoint (#1697)
jaiminpanchal27 Oct 16, 2017
5bfcdc4
Add ad units event (#1702)
hhhjort Oct 17, 2017
1ed7fb5
Update JSDoc for `pbjs.enableAnalytics` (#1565)
rmloveland Oct 17, 2017
c89e911
Don't set non-object configurations (#1704)
matthewlane Oct 17, 2017
54edd80
Renaming of "huddledmasses" adapter into colossusssp (#1701)
Oct 17, 2017
9b5b211
Rubicon feature/s2s test module (#1678)
harpere Oct 17, 2017
ac40506
Fixes: Immediate adapter response may end auction (#1690)
jaiminpanchal27 Oct 17, 2017
17115fc
Initial commit for video support for pbs (#1706)
Oct 17, 2017
819f8fc
Support native click tracking (#1691)
matthewlane Oct 17, 2017
d0140eb
Prebid 0.31.0 Release
jaiminpanchal27 Oct 17, 2017
e74ea2a
Fix for #1628 (allowing standard bidCpmAdjustment) (#1645)
dugwood Oct 17, 2017
75f6dc5
Increment pre version
jaiminpanchal27 Oct 17, 2017
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
4 changes: 2 additions & 2 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
}
},
{
bidder: 'huddledmasses',
bidder: 'colossusssp',
params: {
placement_id: 0
}
Expand Down Expand Up @@ -384,7 +384,7 @@
}
},
{
bidder: 'huddledmasses',
bidder: 'colossusssp',
params: {
placement_id: 0
}
Expand Down
7 changes: 6 additions & 1 deletion modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,17 @@ const AolAdapter = function AolAdapter() {

function _buildNexageApiUrl(bid) {
let {dcn, pos} = bid.params;
let isSecure = (document.location.protocol === 'https:');
let nexageApi = nexageBaseApiTemplate({
protocol: (document.location.protocol === 'https:') ? 'https' : 'http',
protocol: isSecure ? 'https' : 'http',
host: bid.params.host || NEXAGE_SERVER
});
if (dcn && pos) {
let ext = '';
if (isSecure) {
bid.params.ext = bid.params.ext || {};
bid.params.ext.secure = 1;
}
utils._each(bid.params.ext, (value, key) => {
ext += `&${key}=${encodeURIComponent(value)}`;
});
Expand Down
33 changes: 22 additions & 11 deletions modules/appnexusAstBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const spec = {
* @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be sent to the Server.
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(bidRequests) {
buildRequests: function(bidRequests, bidderRequest) {
const tags = bidRequests.map(bidToTag);
const userObjBid = bidRequests.find(hasUserInfo);
let userObj;
Expand Down Expand Up @@ -76,6 +76,7 @@ export const spec = {
method: 'POST',
url: URL,
data: payloadString,
bidderRequest
};
},

Expand All @@ -85,18 +86,27 @@ export const spec = {
* @param {*} serverResponse A successful response from the server.
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: function(serverResponse) {
interpretResponse: function(serverResponse, {bidderRequest}) {
const bids = [];
serverResponse.tags.forEach(serverBid => {
const rtbBid = getRtbBid(serverBid);
if (rtbBid) {
if (rtbBid.cpm !== 0 && SUPPORTED_AD_TYPES.includes(rtbBid.ad_type)) {
const bid = newBid(serverBid, rtbBid);
bid.mediaType = parseMediaType(rtbBid);
bids.push(bid);
if (!serverResponse || serverResponse.error) {
let errorMessage = `in response for ${bidderRequest.bidderCode} adapter`;
if (serverResponse && serverResponse.error) { errorMessage += `: ${serverResponse.error}`; }
utils.logError(errorMessage);
return bids;
}

if (serverResponse.tags) {
serverResponse.tags.forEach(serverBid => {
const rtbBid = getRtbBid(serverBid);
if (rtbBid) {
if (rtbBid.cpm !== 0 && SUPPORTED_AD_TYPES.includes(rtbBid.ad_type)) {
const bid = newBid(serverBid, rtbBid);
bid.mediaType = parseMediaType(rtbBid);
bids.push(bid);
}
}
}
});
});
}
return bids;
},

Expand Down Expand Up @@ -201,6 +211,7 @@ function newBid(serverBid, rtbBid) {
image: nativeAd.main_img && nativeAd.main_img.url,
icon: nativeAd.icon && nativeAd.icon.url,
clickUrl: nativeAd.link.url,
clickTrackers: nativeAd.link.click_trackers,
impressionTrackers: nativeAd.impression_trackers,
};
} else {
Expand Down
103 changes: 103 additions & 0 deletions modules/appnexusAstBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Overview

```
Module Name: AppnexusAst Bid Adapter
Module Type: Bidder Adapter
Maintainer: info@prebid.org
```

# Description

Connects to Appnexus exchange for bids.

AppnexusAst bid adapter supports Banner, Video (instream and outstream) and Native.

# Test Parameters
```
var adUnits = [
// Banner adUnit
{
code: 'banner-div',
sizes: [[300, 250], [300,600]],
bids: [{
bidder: 'appnexusAst',
params: {
placementId: '10433394'
}
}]
},
// Native adUnit
{
code: 'native-div',
sizes: [[300, 250], [300,600]],
mediaTypes: {
native: {
title: {
required: true,
len: 80
},
body: {
required: true
},
brand: {
required: true
},
image: {
required: true
},
clickUrl: {
required: true
},
}
},
bids: [{
bidder: 'appnexusAst',
params: {
placementId: '9880618'
}
}]
},
// Video instream adUnit
{
code: 'video-instream',
sizes: [640, 480],
mediaTypes: {
video: {
context: 'instream'
},
},
bids: [{
bidder: 'appnexusAst',
params: {
placementId: '9333431',
video: {
skippable: true,
playback_methods: ['auto_play_sound_off']
}
}
}]
},
// Video outstream adUnit
{
code: 'video-outstream',
sizes: [[640, 480]],
mediaTypes: {
video: {
context: 'outstream'
}
},
bids: [
{
bidder: 'appnexusAst',
params: {
placementId: '5768085',
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
}
}
}
]
}
];
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ajax} from 'src/ajax';
import {STATUS} from 'src/constants';
import adaptermanager from 'src/adaptermanager';

var BIDDER_CODE = 'huddledmasses';
var BIDDER_CODE = 'colossusssp';

var sizeObj = {
1: '468x60',
Expand Down Expand Up @@ -39,7 +39,7 @@ var sizeObj = {

utils._each(sizeObj, (item, key) => sizeObj[item] = key);

function HuddledMassesAdapter() {
function ColossusSspAdapter() {
function _callBids(bidderRequest) {
var bids = bidderRequest.bids || [];

Expand All @@ -50,9 +50,9 @@ function HuddledMassesAdapter() {
handleRpCB(responseText, bid);
} catch (err) {
if (typeof err === 'string') {
utils.logWarn(`${err} when processing huddledmasses response for placement code ${bid.placementCode}`);
utils.logWarn(`${err} when processing colossus response for placement code ${bid.placementCode}`);
} else {
utils.logError('Error processing huddledmasses response for placement code ' + bid.placementCode, null, err);
utils.logError('Error processing colossus response for placement code ' + bid.placementCode, null, err);
}
var badBid = bidfactory.createBid(STATUS.NO_BID, bid);
badBid.bidderCode = bid.bidder;
Expand All @@ -64,15 +64,15 @@ function HuddledMassesAdapter() {
try {
ajax(buildOptimizedCall(bid), bidCallback, undefined, { withCredentials: true });
} catch (err) {
utils.logError('Error sending huddledmasses request for placement code ' + bid.placementCode, null, err);
utils.logError('Error sending colossus request for placement code ' + bid.placementCode, null, err);
}
});
}

function buildOptimizedCall(bid) {
bid.startTime = (new Date()).getTime();

var parsedSizes = HuddledMassesAdapter.masSizeOrdering(
var parsedSizes = ColossusSspAdapter.masSizeOrdering(
Array.isArray(bid.params.sizes) ? bid.params.sizes.map(size => (sizeObj[size] || '').split('x')) : bid.sizes
);

Expand Down Expand Up @@ -117,7 +117,7 @@ function HuddledMassesAdapter() {
index % 2 === 0 && queryString[index + 1] !== undefined
? memo + curr + '=' + encodeURIComponent(queryString[index + 1]) + '&'
: memo,
'//huddledmassessupply.com/?'
'//colossusssp.com/?'
).slice(0, -1);
}

Expand All @@ -136,12 +136,12 @@ function HuddledMassesAdapter() {
bidmanager.addBidResponse(bidRequest.placementCode, bid);
}

return Object.assign(new Adapter(BIDDER_CODE), { // BIDDER_CODE huddledmasses
return Object.assign(new Adapter(BIDDER_CODE), { // BIDDER_CODE colossusssp
callBids: _callBids
});
}

HuddledMassesAdapter.masSizeOrdering = function (sizes) {
ColossusSspAdapter.masSizeOrdering = function (sizes) {
var MAS_SIZE_PRIORITY = [15, 2, 9];
return utils.parseSizesInput(sizes)
.reduce((result, size) => {
Expand Down Expand Up @@ -169,6 +169,6 @@ HuddledMassesAdapter.masSizeOrdering = function (sizes) {
});
};

adaptermanager.registerBidAdapter(new HuddledMassesAdapter(), 'huddledmasses');
adaptermanager.registerBidAdapter(new ColossusSspAdapter(), BIDDER_CODE);

module.exports = HuddledMassesAdapter;
module.exports = ColossusSspAdapter;
10 changes: 6 additions & 4 deletions modules/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ $$PREBID_GLOBAL$$.express = function(adUnits = $$PREBID_GLOBAL$$.adUnits) {
utils.logWarn('no valid adUnits found, not loading ' + MODULE_NAME);
}

// store gpt slots in a more performant hash lookup by elementId (adUnit code)
var gptSlotCache = {};
// put adUnits in a more performant hash lookup by code.
var adUnitsCache = adUnits.reduce(function (cache, adUnit) {
if (adUnit.code && adUnit.bids) {
Expand Down Expand Up @@ -72,7 +74,7 @@ $$PREBID_GLOBAL$$.express = function(adUnits = $$PREBID_GLOBAL$$.adUnits) {
const adUnit = adUnitsCache[elemId];

if (adUnit) {
adUnit._gptSlot = gptSlot;
gptSlotCache[elemId] = gptSlot; // store by elementId
adUnit.sizes = adUnit.sizes || mapGptSlotSizes(gptSlot.getSizes());
adUnits.push(adUnit);
gptSlots.splice(i, 1);
Expand Down Expand Up @@ -141,7 +143,7 @@ $$PREBID_GLOBAL$$.express = function(adUnits = $$PREBID_GLOBAL$$.adUnits) {
$$PREBID_GLOBAL$$.setTargetingForGPTAsync();
fGptRefresh.apply(pads(), [
adUnits.map(function (adUnit) {
return adUnit._gptSlot;
return gptSlotCache[adUnit.code];
})
]);
}
Expand All @@ -157,7 +159,7 @@ $$PREBID_GLOBAL$$.express = function(adUnits = $$PREBID_GLOBAL$$.adUnits) {
// get already displayed adUnits from aGptSlots if provided, else all defined gptSlots
aGptSlots = defaultSlots(aGptSlots);
var adUnits = pickAdUnits(/* mutated: */ aGptSlots).filter(function (adUnit) {
return adUnit._gptSlot._displayed;
return gptSlotCache[adUnit.code]._displayed;
});

if (aGptSlots.length) {
Expand All @@ -171,7 +173,7 @@ $$PREBID_GLOBAL$$.express = function(adUnits = $$PREBID_GLOBAL$$.adUnits) {
$$PREBID_GLOBAL$$.setTargetingForGPTAsync();
fGptRefresh.apply(pads(), [
adUnits.map(function (adUnit) {
return adUnit._gptSlot
return gptSlotCache[adUnit.code];
}),
options
]);
Expand Down
17 changes: 12 additions & 5 deletions modules/prebidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,25 @@ function PrebidServer() {
/* Prebid executes this function when the page asks to send out bid requests */
baseAdapter.callBids = function(bidRequest) {
const isDebug = !!getConfig('debug');
convertTypes(bidRequest.ad_units);
const adUnits = utils.cloneJson(bidRequest.ad_units);
adUnits.forEach(adUnit => {
let videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video');
if (videoMediaType) {
// pbs expects a ad_unit.video attribute if the imp is video
adUnit.video = Object.assign({}, videoMediaType);
delete adUnit.mediaTypes.video;
}
})
convertTypes(adUnits);
let requestJson = {
account_id: config.accountId,
tid: bidRequest.tid,
max_bids: config.maxBids,
timeout_millis: config.timeout,
secure: config.secure,
url: utils.getTopWindowUrl(),
prebid_version: '$prebid.version$',
ad_units: bidRequest.ad_units.filter(hasSizes),
ad_units: adUnits.filter(hasSizes),
is_debug: isDebug
};

Expand Down Expand Up @@ -245,9 +255,6 @@ function PrebidServer() {
ajax(config.syncEndpoint, (response) => {
try {
response = JSON.parse(response);
if (response.status === 'ok') {
bidderCodes.forEach(code => StorageManager.add(pbjsSyncsKey, code, true));
}
response.bidder_status.forEach(bidder => doBidderSync(bidder.usersync.type, bidder.usersync.url, bidder.bidder));
} catch (e) {
utils.logError(e);
Expand Down
5 changes: 5 additions & 0 deletions modules/pulsepointLiteBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export const spec = {
type: 'iframe',
url: '//bh.contextweb.com/visitormatch'
}];
} else if (syncOptions.pixelEnabled) {
return [{
type: 'image',
url: '//bh.contextweb.com/visitormatch/prebid'
}];
}
}

Expand Down
Loading