Skip to content

Commit

Permalink
IE and Safari compatibility (#2)
Browse files Browse the repository at this point in the history
* Make size mapping mediaType aware (prebid#3134)

* make sizeMapping mediaTypes aware

* no sizeMapping if the only mediaType is not banner

* better logging for size mapping and no auction when no bids

* fix size mapping tests to ignore filter results (which are only for logging)

* Making targeting keys configurable (prebid#3140)

* moved NATIVE_KEYS to constants

* Changed TARGETING_KEYS from array to an array

- Now you can change key names
- Made changes in code at auction.js and targeting.js to handle the TARGETING_KEYS object than array

* fixed aauctionmanager test cases for dynamic targeting key names

* fixed native test cases for dynamic targeting key names

* fixed test cases of targeting for dynamic targeting key names

* in-dev changes

* replace old keys with new keys

* fixed a typo

* fixed a unit case in utils

* updated convertTargetingsFromOldToNew in fixtures

this will now replace partner specific keys as well as per config

* removed a log

* keep test case as it was

* improved convertTargetingsFromOldToNew in fixtures

* Capitalized key names in TARGETING_KEYS object; not values in object

* using computed properties

* using computed properties

* fixed eslint suggestion

* fixed eslint suggestions

* keeping unit tests more compliant with Mocha

* 4235 prebid endpoint return empty array instead of 204 when no bids returned (prebid#3136)

* corrected user sync type

* add alias pxyz
add version to endpoint
add validation for 204 bid response

* add validation with serverResponse is undefined
fix test for 204 (no bid response)

* remove package lock

* restore package-lock

* update gulp 4 notes on README (prebid#3154)

* Add teads bidder adapter (prebid#3135)

* Add teads bidder adapter

* Remove bidder code & tests arrow functions

* Added the option to pass a deal id instead of a partnership id (prebid#3148)

* increment Prebid version

* Prebid 1.26.0 release

* increment prebid version

* implement find polyfill in unit test (prebid#3156)

* InvibesBidAdapter - gdpr support (prebid#3151)

* removed `cookieSyncDelay` from `config` since we have more configuration options now with the `userSync` object (prebid#3142)

* Livewrapped bid and analytics adapter (prebid#3157)

* Livewrapped bid and analytics adapter

* Fixed some tests for browser compatibility

* Fixed some tests for browser compatibility

* Changed analytics adapter code name

* Fix double quote in debug message

* Adding appnexus debug via cookie/params (prebid#3152)

* adding appnexus debug via cookie/params

* removing nested object

* added documentation link and removed useless conditional

* fix lint error on documentation message

* Add RSA validation to Criteo FastBid (prebid#3110)

* Pass Prebid version to Criteo direct bidder

* Update Criteo profile IDs

* Add RSA verification to Criteo FastBid

* Update package-lock with jsencrypt and crypto-js

* Replacing all arrow functions in Mocha function calls

* Update Adapter Version to 14

* Added support for user syncing pixel (prebid#3092)

* Added Polymorph adapter

* Cleaned up code

* Updated var to let

* Updated with mediaType

* Updated tests

* Fixed tests

* Updated polymorph adapter to support cookie syncing and network key integration

* Fixed parens for lint

* Fixed a bug related to network_key approach

* Fixed double negation warning

* Updated tests for network_key

* Added bidId as cache buster and updated tests

* Fixed tests

* Small bugfix and cleanup for Prebid Server OpenRTB code (prebid#3113)

* change bid map to bid_id map and clean up openrtb in pbs

* add src to bids in bid request when known

* Revert "Adding appnexus debug via cookie/params" (prebid#3164)

* Revert "Small bugfix and cleanup for Prebid Server OpenRTB code (prebid#3113)"

This reverts commit a1f07e9.

* Revert "Added support for user syncing pixel (prebid#3092)"

This reverts commit 8fdf61d.

* Revert "Add RSA validation to Criteo FastBid (prebid#3110)"

This reverts commit e72e2dc.

* Revert "Adding appnexus debug via cookie/params (prebid#3152)"

This reverts commit 4797ea2.

* add bid ttl to cache call (prebid#3163)

* Render outstream safeframe  (prebid#3159)

* render outstream safeframe

* move code to Renderer module

* some more logic to move

* Prebid 1.27.0 Release

* increment Prebid version

* rubiconBidAdapter - Checking FPD values are defined before toString() (prebid#3165)

* rubiconBidAdapter - Checking FPD values are defined before toString()
                  - Added two tests for this behavior

* Removing unused variable

* changed to compare against null

added some null params to the tests to verify

* Adding mediaType param to parseSizes in order to ALWAYS get the correct parse Size method correct. (prebid#3166)

* PubMatic to support DigiTrust Id passing (prebid#3160)

* in-dev changes

* included config

* Unit test cases for DigitrustId passing in PubMatic bid adapter

* eslint fixes

* removed a comment

* replaced "() => {" with "() => {"

* OpenX Adapter: Added support for pubcid (prebid#3158)

* use version replace rather than package.json in widespace (prebid#3143)

* Trafficroots Resubmit (prebid#3141)

circleci is still failing, but I cannot find a workaround for this PR at the moment

* Rubicon skip video request in mutlti format when video is not setup (prebid#3167)

* Update rubiconBidAdapter.js

* OpenXOutstream Bid Adapter (prebid#3153)

* adds openxoutstreamadapter files

* cleans up url, adds bidder config and version, removes unused code

* updates template ad response

* remove final unused custom param code

* add openrtb to list of params again.

* add payload back so we can read bidId

* extra checks for cpm (pub_rev)

* adds unit tests

* adds unit tests

* update md page

* undo openx adapter space changes from autosave

* undo openx adapter space changes from autosave

* test cleanup

* test cleanup

* update md file

* update example page params

* remove sneaky console.log

* return false

* adds yieldmo to the md. remove useless docEl assignment

* remove useless docEl assignments

* move crid and adid to constants

* fix test

* remove another useless variable assignment caught by LGTM

* changes CR_ID. moves tdoc to within if scope

* updates crid on test

* use more constants and use crid for lfid

* remove superfluous trailing argument

* adds viewport meta tag to header. removes unnecessary string interpolation.

* move ad_id to a string

* undo changes for pacakge-lock

* fixes lfid to lfId, pID to pId

* fixes lfid to lfId, pID to pId

* remove rti:1

* adds openx maintainer email

* improves additional data passed to the handler in AuctionInit and AuctionEnd events (prebid#3168)

* removing cookieSet (prebid#3175)

* removing cookieSet

* removing blank line

* not including src/cookie anymore

* Removed deprecated priceType option (+tests) (prebid#3170)

* Improve Digital adapter: set dealID based on buying type (prebid#3182)

* Adding GDPR support

* Always drop user syncs when available

* Set dealID based on buying type

* disabling tests that are failing in safari (prebid#3186)

* Prebid 1.28.0 Release

* Increment pre version

* RVR-1124 Setup initial skeleton analytics adapter that can send something.

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Formatted auction/events data to fit needed schema.

* RVR-1135 fetched device data.

* Applied feedback.

* Applied feedback.

* Fetched core.

* Added click handler for reporting banners click events.

* Applied analyzer for reporting displayed impressions.

* Applied feedback.

* Merged in RVR-1214-invoke-handlers-on-rendering (pull request #7)

RVR-1214 Invoke handlers on rendering

* RVR-1214 Invoked handlers right after ad is displayed.

* Applied feedback.

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Merged in RVR-1192-configuration-global-parameters (pull request #8)

RVR-1192 Configuration/Global parameters

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Merged in RVR-1181-Prebid-js-unit-tests-setup (pull request #6)

RVR-1181 Prebid.js Unit tests setup

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Merged in RVR-1247-additional-data-to-impression-records (pull request #9)

RVR-1247 Additional data to impression records

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Merged in RVR-1249-add-requestedbids-to-auction (pull request #10)

RVR-1249 Add requested bids to auction object request.

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Merged in RVR-1261-fix-tests (pull request prebid#11)

RVR-1261 fix tests

* RVR-1261 Secured adapter from no containers configuration. And changed fetching URL.

* RVR-1261 Added event check for request and changed some names.

* Applied feedback.

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* RVR-1352 analytics adapter bugs

Approved-by: Alessandro Di Giovanni <alessandro.digiovanni@gamegenetics.de>

* Fixed bug with geolocation notification.

* fixed missing bracket.

* one more fix.

* RVR-1357 Different optimisation responses & tracking into auction event

* RVR-1852 - Add content type and hardcoded auth headers

(cherry picked from commit 4def881)

* RVR-1852 - Change tracker host

* RVR-1852 - Override content type instead of adding header

* districtmDMX new adapter (prebid#2765)

* adding DMX

test @97%, two files added one updated

* Update districtm_spec.js

* Update districtmDMX.js

* adding all districtm needed file

* remove legacy file

* remove typo || 0 in the test method

* force default to return a valid width and height

* update unit test code for failing test

* changed class for an object

* remove package-lock.json

* upgrade to gulp 4 (prebid#2930)

* upgrade to gulp 4

* update circleci config

* removed some tasks and added notest flag

* update lint dependency for test task

* RVR-1914 Consistent data types in events

Also removes undefined and null properties in audience events

* Merged in RVR-1883-Add-Basic-Access-Authentication (pull request prebid#17)

RVR-1883 Add Basic Access Authentication

* RVR-1914 - Rename functions

* RVR-1914 - Set default total_duration to null in bid response

* RVR-1883 - Use RIVR_CLIENT_AUTH_TOKEN global variable for Auth token

* RVR-1883 - Restore stub after every test not just at the end

* RVR-1883 - Remove commented code

* Increase code coverage

* Fix for IE 11.0.0 and Safari 8.0.8 - includes()

Use core-js includes function for array
  • Loading branch information
AlessandroDG authored Oct 17, 2018
1 parent 4896e8e commit e0529b7
Show file tree
Hide file tree
Showing 66 changed files with 6,370 additions and 6,977 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ Working examples can be found in [the developer docs](http://prebid.org/dev-docs
*Note:* Because we have transitioned to using gulp 4.0 - you need to have `gulp-cli` installed globally prior to running the general `npm install`. Run the following command to perform the install: `npm install gulp-cli -g`
If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. This removal can be done with the command: `npm rm gulp -g`

*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To compily with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in it's setup.

If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. You can check if this is installed by running `gulp -v` and seeing the version that's listed in the `CLI` field of the output. If you have the `gulp` package installd globally, it's likely the same version that you'll see in the `Local` field. If you already have `gulp-cli` installed, it should be a lower major version (it's at version `2.0.1` at the time of the transition).

To remove the old package, you can use the command: `npm rm gulp -g`

Once setup, run the following command to globally install the `gulp-cli` package: `npm install gulp-cli -g`


<a name="Build"></a>

## Build for Development
Expand Down
10 changes: 10 additions & 0 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@
channelCode: 2264002816, //REQUIRED
dimId: 9 //REQUIRED
}
},
{
bidder: 'openxoutstream',
params: {
unit: '53943996499',
delDomain: 'se-demo-d.openx.net',
publisher_page_url: 'yieldmo.com',
width: '300',
height: '250',
}
}

]
Expand Down
49 changes: 45 additions & 4 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { registerBidder } from 'src/adapters/bidderFactory';
import { parse } from 'src/url';
import * as utils from 'src/utils';
import find from 'core-js/library/fn/array/find';
import JSEncrypt from 'jsencrypt/bin/jsencrypt';
import sha256 from 'crypto-js/sha256';

const ADAPTER_VERSION = 11;
const ADAPTER_VERSION = 14;
const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = '//bidder.criteo.com/cdb';
const CRITEO_VENDOR_ID = 91;
Expand All @@ -17,6 +19,13 @@ const PROFILE_ID_PUBLISHERTAG = 185;
// Unminified source code can be found in: https://github.com/Prebid-org/prebid-js-external-js-criteo/blob/master/dist/prod.js
const PUBLISHER_TAG_URL = '//static.criteo.net/js/ld/publishertag.prebid.js';

export const FAST_BID_PUBKEY = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDO1BjAITkFTtP0IMzmF7qsqhpu
y1dGaTPHnjMU9mRZsrnfR3C0sEN5pYEzEcFRPnkJjJuhH8Rnh5+CE+LcKg0Z8ZZ7
OmOSj0/qnYTAYCu0cR5LiyWG79KlIgUyMbp92ulGg24gAyGrVn4+v/4c53WlOEUp
4YWvb82G0CD5NcDNpQIDAQAB
-----END PUBLIC KEY-----`;

/** @type {BidderSpec} */
export const spec = {
code: BIDDER_CODE,
Expand Down Expand Up @@ -251,20 +260,52 @@ function createNativeAd(id, payload, callback) {
</script>`;
}

export function cryptoVerify(key, hash, code) {
var jse = new JSEncrypt();
jse.setPublicKey(key);
return jse.verify(code, hash, sha256);
}

function validateFastBid(fastBid) {
// The value stored must contain the file's encrypted hash as first line
const firstLineEnd = fastBid.indexOf('\n');
const firstLine = fastBid.substr(0, firstLineEnd).trim();
if (firstLine.substr(0, 9) !== '// Hash: ') {
utils.logWarn('No hash found in FastBid');
return false;
}

// Remove the hash part from the locally stored value
const fileEncryptedHash = firstLine.substr(9);
const publisherTag = fastBid.substr(firstLineEnd + 1);

// Verify the hash using cryptography
try {
return cryptoVerify(FAST_BID_PUBKEY, fileEncryptedHash, publisherTag);
} catch (e) {
utils.logWarn('Failed to verify Criteo FastBid');
return undefined;
}
}

/**
* @return {boolean}
*/
function tryGetCriteoFastBid() {
try {
const fastBid = localStorage.getItem('criteo_fast_bid');
if (fastBid !== null) {
eval(fastBid); // eslint-disable-line no-eval
return true;
if (validateFastBid(fastBid) === false) {
utils.logWarn('Invalid Criteo FastBid found');
localStorage.removeItem('criteo_fast_bid');
} else {
utils.logInfo('Using Criteo FastBid');
eval(fastBid); // eslint-disable-line no-eval
}
}
} catch (e) {
// Unable to get fast bid
}
return false;
}

registerBidder(spec);
155 changes: 155 additions & 0 deletions modules/districtmDmxAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';
import {config} from 'src/config';

const BIDDER_CODE = 'districtmDMX';

const DMXURI = 'https://dmx.districtm.io/b/v1';

export const spec = {
code: BIDDER_CODE,
supportedFormat: ['banner'],
isBidRequestValid(bid) {
return !!(bid.params.dmxid && bid.params.memberid);
},
interpretResponse(response, bidRequest) {
response = response.body || {};
if (response.seatbid) {
if (utils.isArray(response.seatbid)) {
const {seatbid} = response;
let winners = seatbid.reduce((bid, ads) => {
let ad = ads.bid.reduce(function(oBid, nBid) {
if (oBid.price < nBid.price) {
const bid = matchRequest(nBid.impid, bidRequest);
const {width, height} = defaultSize(bid);
nBid.cpm = nBid.price;
nBid.bidId = nBid.impid;
nBid.requestId = nBid.impid;
nBid.width = nBid.w || width;
nBid.height = nBid.h || height;
nBid.ad = nBid.adm;
nBid.netRevenue = true;
nBid.creativeId = nBid.crid;
nBid.currency = 'USD';
nBid.ttl = 60;

return nBid;
} else {
oBid.cpm = oBid.price;
return oBid;
}
}, {price: 0});
if (ad.adm) {
bid.push(ad)
}
return bid;
}, [])
let winnersClean = winners.filter(w => {
if (w.bidId) {
return true;
}
return false;
});
return winnersClean;
} else {
return [];
}
} else {
return [];
}
},
buildRequests(bidRequest, bidderRequest) {
let timeout = config.getConfig('bidderTimeout');
let dmxRequest = {
id: utils.generateUUID(),
cur: ['USD'],
tmax: (timeout - 300),
test: this.test() || 0,
site: {
publisher: { id: String(bidRequest[0].params.memberid) || null }
}
}
if (!dmxRequest.test) {
delete dmxRequest.test;
}
if (bidderRequest.gdprConsent) {
dmxRequest.regs = {};
dmxRequest.regs.ext = {};
dmxRequest.regs.ext.gdpr = bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0;
if (dmxRequest.regs.ext.gdpr) {
dmxRequest.regs.ext.consent = bidderRequest.gdprConsent.consentString;
}
}
let tosendtags = bidRequest.map(dmx => {
var obj = {};
obj.id = dmx.bidId;
obj.tagid = String(dmx.params.dmxid);
obj.secure = window.location.protocol === 'https:' ? 1 : 0;
obj.banner = {
topframe: 1,
w: dmx.sizes[0][0] || 0,
h: dmx.sizes[0][1] || 0,
format: dmx.sizes.map(s => {
return {w: s[0], h: s[1]};
})
};
return obj;
});
dmxRequest.imp = tosendtags;
return {
method: 'POST',
url: DMXURI,
data: JSON.stringify(dmxRequest),
options: {
contentType: 'application/json',
withCredentials: true
},
bidderRequest
}
},
test() {
return window.location.href.indexOf('dmTest=true') !== -1 ? 1 : 0;
},
getUserSyncs(optionsType) {
if (optionsType.iframeEnabled) {
return [{
type: 'iframe',
url: 'https://cdn.districtm.io/ids/index.html'
}];
}
}
}

/**
* Function matchRequest(id: string, BidRequest: object)
* @param id
* @type string
* @param bidRequest
* @type Object
* @returns Object
*
*/
export function matchRequest(id, bidRequest) {
const {bids} = bidRequest.bidderRequest;
const [returnValue] = bids.filter(bid => bid.bidId === id);
return returnValue;
}
export function checkDeepArray(Arr) {
if (Array.isArray(Arr)) {
if (Array.isArray(Arr[0])) {
return Arr[0];
} else {
return Arr;
}
} else {
return Arr;
}
}
export function defaultSize(thebidObj) {
const {sizes} = thebidObj;
const returnObject = {};
returnObject.width = checkDeepArray(sizes)[0];
returnObject.height = checkDeepArray(sizes)[1];
return returnObject;
}
registerBidder(spec);
31 changes: 31 additions & 0 deletions modules/districtmDmxAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Overview

```
Module Name: DistrictM Bid Adapter
Module Type: Bidder Adapter
Maintainer: steve@districtm.net
```

# Description

Adapter that connects to DistrictM's demand sources.
This version only support banner

# Test Parameters
```
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
}
},
bids: [{
bidder: 'districtmDMX',
params: {
dmxid: 100001,
memberid: 100003
}
}]
}];
```
21 changes: 17 additions & 4 deletions modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { config } from 'src/config';
const BIDDER_CODE = 'improvedigital';

export const spec = {
version: '4.3.0',
version: '4.4.0',
code: BIDDER_CODE,
aliases: ['id'],

Expand Down Expand Up @@ -78,11 +78,24 @@ export const spec = {
bid.cpm = parseFloat(bidObject.price);
bid.creativeId = bidObject.crid;
bid.currency = bidObject.currency ? bidObject.currency.toUpperCase() : 'USD';
if (utils.isNumber(bidObject.lid)) {

// Deal ID. Composite ads can have multiple line items and the ID of the first
// dealID line item will be used.
if (utils.isNumber(bidObject.lid) && bidObject.buying_type === 'deal_id') {
bid.dealId = bidObject.lid;
} else if (typeof bidObject.lid === 'object' && bidObject.lid['1']) {
bid.dealId = bidObject.lid['1'];
} else if (Array.isArray(bidObject.lid) &&
Array.isArray(bidObject.buying_type) &&
bidObject.lid.length === bidObject.buying_type.length) {
let isDeal = false;
bidObject.buying_type.forEach((bt, i) => {
if (isDeal) return;
if (bt === 'deal_id') {
isDeal = true;
bid.dealId = bidObject.lid[i];
}
});
}

bid.height = bidObject.h;
bid.netRevenue = bidObject.isNet ? bidObject.isNet : false;
bid.requestId = bidObject.id;
Expand Down
Loading

0 comments on commit e0529b7

Please sign in to comment.