Skip to content

Commit

Permalink
Merge pull request prebid#13 from prebid/master
Browse files Browse the repository at this point in the history
merge from latest prebid master
  • Loading branch information
pm-manasi-moghe authored Mar 20, 2019
2 parents 7cb5041 + 6cd91f9 commit 6c50bd3
Show file tree
Hide file tree
Showing 55 changed files with 3,305 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
# run tests!
- run:
name: BrowserStack testing
command: gulp test --browserstack
command: gulp test --browserstack --nolintfix
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function lint(done) {
return file.eslint != null && file.eslint.fixed;
}
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'], {base: './'})
.pipe(eslint({fix: true}))
.pipe(gulpif(argv.nolintfix, eslint(), eslint({fix: true})))
.pipe(eslint.format('stylish'))
.pipe(eslint.failAfterError())
.pipe(gulpif(isFixed, gulp.dest('./')));
Expand Down
5 changes: 4 additions & 1 deletion modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
import {BANNER, NATIVE} from '../src/mediaTypes';
import { config } from '../src/config';
import {config} from '../src/config';
const ADG_BIDDER_CODE = 'adgeneration';

export const spec = {
Expand Down Expand Up @@ -156,6 +156,9 @@ function createNativeAd(body) {
case 6:
native.cta = assets[i].data.value;
break;
case 502:
native.privacyLink = encodeURIComponent(assets[i].data.value);
break;
}
}
native.clickUrl = body.native_ad.link.url;
Expand Down
5 changes: 4 additions & 1 deletion modules/adgenerationBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ var adUnits = [
},
icon: {
required: true
}
},
privacyLink: {
required: true
},
},
},
bids: [
Expand Down
16 changes: 16 additions & 0 deletions modules/adpod.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function attachPriceIndustryDurationKeyToBid(bid, brandCategoryExclusion) {
}
bid.adserverTargeting[TARGETING_KEY_PB_CAT_DUR] = pcd;
bid.adserverTargeting[TARGETING_KEY_CACHE_ID] = initialCacheKey;
bid.videoCacheKey = initialCacheKey;
bid.customCacheKey = `${pcd}_${initialCacheKey}`;
}

Expand Down Expand Up @@ -412,3 +413,18 @@ export function callPrebidCacheAfterAuction(bids, callback) {
}
})
}

/**
* Compare function to be used in sorting long-form bids. This will compare bids on price per second.
* @param {Object} bid
* @param {Object} bid
*/
export function sortByPricePerSecond(a, b) {
if (a.cpm / a.video.durationBucket < b.cpm / b.video.durationBucket) {
return 1;
}
if (a.cpm / a.video.durationBucket > b.cpm / b.video.durationBucket) {
return -1;
}
return 0;
}
2 changes: 1 addition & 1 deletion modules/advangelistsBidAdapter.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import find from 'core-js/library/fn/array/find';
import includes from 'core-js/library/fn/array/includes';

const ADAPTER_VERSION = '1.0';
const BIDDER_CODE = 'avng';
const BIDDER_CODE = 'advangelists';

export const VIDEO_ENDPOINT = '//nep.advangelists.com/xp/get?pubid=';// 0cf8d6d643e13d86a5b6374148a4afac';
export const BANNER_ENDPOINT = '//nep.advangelists.com/xp/get?pubid=';// 0cf8d6d643e13d86a5b6374148a4afac';
Expand Down
4 changes: 2 additions & 2 deletions modules/advangelistsBidAdapter.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var displayAdUnit = [
[320, 50]
],
bids: [{
bidder: 'avng',
bidder: 'advangelists',
params: {
pubid: '0cf8d6d643e13d86a5b6374148a4afac',
placement: 1234
Expand All @@ -47,7 +47,7 @@ var videoAdUnit = {
},
bids: [
{
bidder: 'avng',
bidder: 'advangelists',
params: {
pubid: '8537f00948fc37cc03c5f0f88e198a76',
placement: 1234,
Expand Down
21 changes: 18 additions & 3 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import includes from 'core-js/library/fn/array/includes'
* updated to latest prebid repo on 2017.10.20
* updated for gdpr compliance on 2018.05.22 -requires gdpr compliance module
* updated to pass aditional auction and impression level parameters. added pass for video targeting parameters
* updated to fix native support for image width/height and icon 2019.03.17
*/

const BIDDER_CODE = 'adxcg'
Expand Down Expand Up @@ -210,8 +211,10 @@ export const spec = {
let nativeResponse = serverResponseOneItem.nativeResponse

bid['native'] = {
clickUrl: encodeURIComponent(nativeResponse.link.url),
impressionTrackers: nativeResponse.imptrackers
clickUrl: nativeResponse.link.url,
impressionTrackers: nativeResponse.imptrackers,
clickTrackers: nativeResponse.clktrackers,
javascriptTrackers: nativeResponse.jstrackers
}

nativeResponse.assets.forEach(asset => {
Expand All @@ -220,7 +223,19 @@ export const spec = {
}

if (asset.img && asset.img.url) {
bid['native'].image = asset.img.url
let nativeImage = {}
nativeImage.url = asset.img.url
nativeImage.height = asset.img.h
nativeImage.width = asset.img.w
bid['native'].image = nativeImage
}

if (asset.icon && asset.icon.url) {
let nativeIcon = {}
nativeIcon.url = asset.icon.url
nativeIcon.height = asset.icon.h
nativeIcon.width = asset.icon.w
bid['native'].icon = nativeIcon
}

if (asset.data && asset.data.label === 'DESC' && asset.data.value) {
Expand Down
39 changes: 37 additions & 2 deletions modules/ajaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Renderer } from '../src/Renderer';
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
import { VIDEO, BANNER } from '../src/mediaTypes';
import { VIDEO, BANNER, NATIVE } from '../src/mediaTypes';

const BIDDER_CODE = 'aja';
const URL = '//ad.as.amanad.adtdp.com/v2/prebid';
Expand All @@ -14,7 +14,7 @@ const AD_TYPE = {

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [VIDEO, BANNER],
supportedMediaTypes: [VIDEO, BANNER, NATIVE],

isBidRequestValid: function(bid) {
return !!(bid.params.asi);
Expand Down Expand Up @@ -86,6 +86,41 @@ export const spec = {
} catch (error) {
utils.logError('Error appending tracking pixel', error);
}
} else if (AD_TYPE.NATIVE === ad.ad_type) {
const nativeAds = ad.native.template_and_ads.ads;

nativeAds.forEach(nativeAd => {
const assets = nativeAd.assets;

Object.assign(bid, {
mediaType: NATIVE
});

bid.native = {
title: assets.title,
body: assets.description,
cta: assets.cta_text,
sponsoredBy: assets.sponsor,
clickUrl: assets.lp_link,
impressionTrackers: nativeAd.imps,
};

if (assets.img_main !== undefined) {
bid.native.image = {
url: assets.img_main,
width: parseInt(assets.img_main_width, 10),
height: parseInt(assets.img_main_height, 10)
};
}

if (assets.img_icon !== undefined) {
bid.native.icon = {
url: assets.img_icon,
width: parseInt(assets.img_icon_width, 10),
height: parseInt(assets.img_icon_height, 10)
};
}
});
}

return [bid];
Expand Down
48 changes: 43 additions & 5 deletions modules/ajaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Connects to Aja exchange for bids.
Aja bid adapter supports Banner and Outstream Video.

# Test Parameters
```
```js
var adUnits = [
// Banner adUnit
{
code: 'banner-div',
code: 'prebid_banner',
mediaTypes: {
banner: {
sizes: [
Expand All @@ -26,13 +26,13 @@ var adUnits = [
bids: [{
bidder: 'aja',
params: {
asi: 'szs4htFiR'
asi: 'tk82gbLmg'
}
}]
},
// Video outstream adUnit
{
code: 'video-outstream',
code: 'prebid_video',
mediaTypes: {
video: {
context: 'outstream',
Expand All @@ -42,7 +42,45 @@ var adUnits = [
bids: [{
bidder: 'aja',
params: {
asi: 'Kp2O2tFig'
asi: '1-KwEG_iR'
}
}]
},
// Native adUnit
{
code: 'prebid_native',
mediaTypes: {
native: {
image: {
required: true,
sendId: false
},
title: {
required: true,
sendId: true
},
sponsoredBy: {
required: false,
sendId: true
},
clickUrl: {
required: false,
sendId: true
},
body: {
required: false,
sendId: true
},
icon: {
required: false,
sendId: false
}
}
},
bids: [{
bidder: 'aja',
params: {
asi: 'qxueUGliR'
}
}]
}
Expand Down
Loading

0 comments on commit 6c50bd3

Please sign in to comment.