Skip to content

Commit

Permalink
Prebid Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
aecook committed Aug 14, 2018
2 parents 737ab6e + f4a3d4f commit 137292f
Show file tree
Hide file tree
Showing 88 changed files with 4,496 additions and 1,390 deletions.
50 changes: 50 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/Prebid.js

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run: sudo npm install -g gulp
# Download and run BrowserStack local
- run:
name : Download BrowserStack Local binary and start it.
command : |
# Download the browserstack binary file
wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
# Unzip it
unzip BrowserStackLocal-linux-x64.zip
# Run the file with user's access key
./BrowserStackLocal ${BROWSERSTACK_ACCESS_KEY} &
# run tests!
- run:
name: BrowserStack testing
command: gulp test --browserstack
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = {
// Violations of these styles should be fixed, and the exceptions removed over time.
//
// See Issue #1111.
"camelcase": "off",
"eqeqeq": "off",
"no-return-assign": "off",
"no-throw-literal": "off",
Expand Down
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/prebid/Prebid.js.svg?branch=master)](https://travis-ci.org/prebid/Prebid.js)
[![Build Status](https://circleci.com/gh/prebid/Prebid.js.svg?style=svg)](https://circleci.com/gh/prebid/Prebid.js)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/prebid/Prebid.js.svg)](http://isitmaintained.com/project/prebid/Prebid.js "Percentage of issues still open")
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/prebid/Prebid.js.svg)](http://isitmaintained.com/project/prebid/Prebid.js "Average time to resolve an issue")
[![Code Climate](https://codeclimate.com/github/prebid/Prebid.js/badges/gpa.svg)](https://codeclimate.com/github/prebid/Prebid.js)
Expand Down
15 changes: 15 additions & 0 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,21 @@
host: 'dsp-staging.adkernel.com' //OPTIONAL
}
},
{
bidder: 'bizzclick',
params: {
placementId: 0,
type: "banner"
}
},
{
bidder: 'zedo',
params: {
channelCode: 2264002816, //REQUIRED
dimId: 9 //REQUIRED
}
}

]
}, {
code: 'div-gpt-ad-12345678-1',
Expand Down Expand Up @@ -427,6 +435,13 @@
params: {
zone: '276' // REQUIRED Zone Id (276 is a test zone)
}
},
{
bidder: 'bizzclick',
params: {
placementId: 0,
type: "banner"
}
}
]
}
Expand Down
57 changes: 28 additions & 29 deletions modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { userSync } from 'src/userSync'
import { uniques } from 'src/utils';
const { registerBidder } = require('../src/adapters/bidderFactory');
const { config } = require('../src/config');

const BIDDER_CODE = '33across';
const END_POINT = 'https://ssc.33across.com/api/v1/hb';
const SYNC_ENDPOINT = 'https://de.tynt.com/deb/v2?m=xch&rt=html';

const adapterState = {};

// All this assumes that only one bid is ever returned by ttx
function _createBidResponse(response) {
return {
Expand Down Expand Up @@ -42,19 +43,21 @@ function _createServerRequest(bidRequest) {
}
}
ttxRequest.site = { id: params.siteId };

// Go ahead send the bidId in request to 33exchange so it's kept track of in the bid response and
// therefore in ad targetting process
ttxRequest.id = bidRequest.bidId;

// Finally, set the openRTB 'test' param if this is to be a test bid
if (params.test === 1) {
ttxRequest.test = 1;
}

/*
* Now construt the full server request
* Now construct the full server request
*/
const options = {
contentType: 'application/json',
contentType: 'text/plain',
withCredentials: true
};
// Allow the ability to configure the HB endpoint for testing purposes.
Expand All @@ -70,6 +73,17 @@ function _createServerRequest(bidRequest) {
}
}

// Sync object will always be of type iframe for TTX
function _createSync(siteId) {
const ttxSettings = config.getConfig('ttxSettings');
const syncUrl = (ttxSettings && ttxSettings.syncUrl) || SYNC_ENDPOINT;

return {
type: 'iframe',
url: `${syncUrl}&id=${siteId}`
}
}

function _getFormatSize(sizeArr) {
return {
w: sizeArr[0],
Expand All @@ -78,24 +92,6 @@ function _getFormatSize(sizeArr) {
}
}

// Register one sync per bid since each ad unit may potenitally be linked to a uniqe guid
// Sync type will always be 'iframe' for 33Across
function _registerUserSyncs(requestData) {
let ttxRequest;
try {
ttxRequest = JSON.parse(requestData);
} catch (err) {
// No point in trying to register sync since the requisite data cannot be parsed.
return;
}
const ttxSettings = config.getConfig('ttxSettings');

let syncUrl = (ttxSettings && ttxSettings.syncUrl) || SYNC_ENDPOINT;

syncUrl = `${syncUrl}&id=${ttxRequest.site.id}`;
userSync.registerSync('iframe', BIDDER_CODE, syncUrl);
}

function isBidRequestValid(bid) {
if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
return false;
Expand All @@ -108,18 +104,15 @@ function isBidRequestValid(bid) {
return true;
}

// NOTE: At this point, 33exchange only accepts request for a single impression
// NOTE: At this point, TTX only accepts request for a single impression
function buildRequests(bidRequests) {
adapterState.uniqueSiteIds = bidRequests.map(req => req.params.siteId).filter(uniques);

return bidRequests.map(_createServerRequest);
}

// NOTE: At this point, the response from 33exchange will only ever contain one bid i.e. the highest bid
function interpretResponse(serverResponse, bidRequest) {
// Register user sync first
if (bidRequest && bidRequest.data) {
_registerUserSyncs(bidRequest.data);
}

const bidResponses = [];

// If there are bids, look at the first bid of the first seatbid (see NOTE above for assumption about ttx)
Expand All @@ -130,11 +123,17 @@ function interpretResponse(serverResponse, bidRequest) {
return bidResponses;
}

// Register one sync per unique guid
function getUserSyncs(syncOptions) {
return (syncOptions.iframeEnabled) ? adapterState.uniqueSiteIds.map(_createSync) : ([]);
}

const spec = {
code: BIDDER_CODE,
isBidRequestValid,
buildRequests,
interpretResponse
interpretResponse,
getUserSyncs
}

registerBidder(spec);
Expand Down
69 changes: 3 additions & 66 deletions modules/33acrossBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name: 33Across Bid Adapter
Module Type: Bidder Adapter
Maintainer: aparna.hegde@33across.com
Maintainer: headerbidding@33across.com
```

# Description
Expand All @@ -24,72 +24,9 @@ var adUnits = [
bids: [{
bidder: '33across',
params: {
siteId: 'pub1234',
productId: 'infeed'
siteId: 'examplePub1234',
productId: 'siab'
}
}]
}
```

# Ad Unit and Setup: For Testing
In order to receive bids please map localhost to (any) test domain.

```
<--! Prebid Config section >
<script>
var PREBID_TIMEOUT = 3000;
var adUnits = [
{
code: '33across-hb-ad-123456-1',
sizes: [
[300, 250],
[728, 90]
],
bids: [{
bidder: '33across',
params: {
site: {
id: 'aRlI5W_9yr5jkxacwqm_6r',
page: "http://thinkbabynames.com/baby-mcbabyface",
ext: {
ttx: {
ssp_configs: [
{
"name": "index",
"enabled": false
},
{
"name": "rubicon",
"enabled": true
},
{
"name": "33xchange",
"enabled": false
}
]
}
}
},
productId: 'infeed'
}
}]
}
];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
// Adjust bid CPM to ensure it wins the auction (USED ONLY FOR TESTING). Need to do this since test bids have too low a CPM
pbjs.bidderSettings = {
'33across': {
bidCpmAdjustment : function(bidCpm, bid){
// adjust the bid in real time before the auction takes place, only do so for valid bids ignore no bids
if (bid.w !== 0 && bid.h !== 0 && bidCpm !== 0) {
return bidCpm + 0.50;
}
}
}
};
</script>
<!-- End Prebid Config section>
```
2 changes: 1 addition & 1 deletion modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const spec = {
return serverResponses.filter(rps => rps.body && rps.body.syncpages)
.map(rsp => rsp.body.syncpages)
.reduce((a, b) => a.concat(b), [])
.map(sync_url => ({type: 'iframe', url: sync_url}));
.map(syncUrl => ({type: 'iframe', url: syncUrl}));
}
};

Expand Down
2 changes: 1 addition & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const spec = {
return serverResponses.filter(rsp => rsp.body && rsp.body.ext && rsp.body.ext.adk_usersync)
.map(rsp => rsp.body.ext.adk_usersync)
.reduce((a, b) => a.concat(b), [])
.map(sync_url => ({type: 'iframe', url: sync_url}));
.map(syncUrl => ({type: 'iframe', url: syncUrl}));
}
};

Expand Down
Loading

0 comments on commit 137292f

Please sign in to comment.