Skip to content

Commit

Permalink
Merge pull request #3 from prebid/master
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
patmmccann authored Apr 6, 2021
2 parents 078473b + b352c7d commit e7b5d01
Show file tree
Hide file tree
Showing 77 changed files with 3,922 additions and 459 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function test(done) {
} else {
var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file);

var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase);
var browserOverride = helpers.parseBrowserArgs(argv);
if (browserOverride.length > 0) {
karmaConf.browsers = browserOverride;
}
Expand Down
211 changes: 211 additions & 0 deletions integrationExamples/gpt/adloox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<!DOCTYPE html>
<html>
<head>
<title>Prebid Display/Video Merged Auction with Adloox Integration</title>

<script async src="http://localhost:9999/build/dev/prebid.js"></script>
<!-- <script async src="https://storage.googleapis.com/adloox-ads-js-test/prebid.js"></script> -->
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>

<script>
// set to 10s (rather than 100ms) only to assist development as 'Local Overrides' stalls for >1s :-/
var AUCTION_DELAY = 10000; // recommended to be set to 100 in production
var PREBID_TIMEOUT = 1000;
var FAILSAFE_TIMEOUT = AUCTION_DELAY + (3 * PREBID_TIMEOUT);

var div_1_sizes = [ [728, 90] ];
var div_2_sizes = [ [300, 250] ];
var video_1_size = [ 640, 480 ];

var adUnits = [
{
code: 'div-1',
mediaTypes: {
banner: {
sizes: div_1_sizes
}
},
bids: [
{
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816
}
}
]
},
{
code: 'div-2',
mediaTypes: {
banner: {
sizes: div_2_sizes
}
},
bids: [
{
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816
}
}
]
}
];

var videoAdUnit = {
code: 'video-1',
mediaTypes: {
video: {
context: 'instream',
playerSize: [ 640, 480 ]
}
},
fpd: {
context: {
pbAdSlot: '/19968336/prebid_cache_video_adunit'
}
},
bids: [
{
bidder: 'spotx',
params: {
channel_id: 85394,
ad_unit: 'instream'
}
}
]
};

window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(function() {
googletag
.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1')
.addService(googletag.pubads());
googletag
.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2')
.addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

var tempTag = false;
var invokeVideoPlayer = function(url) {
tempTag = url;
};

function sendAdserverRequest(bids, timedOut, auctionId) {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;

googletag.cmd.push(function() {
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(adUnits);
googletag.pubads().refresh();
});

var videoBids = bids[videoAdUnit.code];
if (videoBids) {
var videoUrl = videoBids.bids[0].vastUrl;
// var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
// adUnit: videoAdUnit,
// params: {
// iu: '/19968336/prebid_cache_video_adunit',
// cust_params: {
// section: 'blog',
// anotherKey: 'anotherValue'
// },
// output: 'vast'
// }
// });
invokeVideoPlayer(videoUrl);
}
}

// optionally wrap with googletag to have gpt-pre-auction
// automatically populate Prebid Ad Slot (pbAdSlot)
// https://docs.prebid.org/dev-docs/modules/gpt-pre-auction.html
// alternatively remove wrapping and set AdUnit.fpd.context.pbAdSlot
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setConfig({
instreamTracking: {
enabled: true
},
rubicon: {
singleRequest: true
}
});
pbjs.enableAnalytics({
provider: 'adloox',
options: {
client: 'adlooxtest',
clientid: 127,
platformid: 0,
tagid: 0
}
});
pbjs.addAdUnits(adUnits);
pbjs.addAdUnits(videoAdUnit);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
})
});
});

setTimeout(function() {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);
</script>
</head>
<body>
<h1>Prebid Display/Video Merged Auction with Adloox Integration</h1>

<h2>div-1</h2>
<div id="div-1">
<script>
googletag.cmd.push(function() {
googletag.display('div-1');
});
</script>
</div>

<h2>div-2</h2>
<div id="div-2">
<script>
googletag.cmd.push(function() {
googletag.display('div-2');
});
</script>
</div>

<h2>video-1</h2>
<div id="video-1"></div>
<script src="https://content.jwplatform.com/libraries/72xIKEe6.js"></script>
<script>
var playerInstance = jwplayer('video-1');
invokeVideoPlayer = function(url) {
playerInstance.setup({
"playlist": "https://content.jwplatform.com/feeds/ae4tmw2D.json",
"width": 640,
"height": 480,
"advertising": {
"client": "vast",
"tag": url
}
});
};
if (tempTag) {
invokeVideoPlayer(tempTag);
tempTag = false;
}
</script>
</body>
</html>
15 changes: 9 additions & 6 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@
}, {
name: "merkleId",
params: {
ptk: '12345678-aaaa-bbbb-cccc-123456789abc', //Set your real merkle partner key here
pubid: 'EXAMPLE' //Set your real merkle publisher id here
},
vendor:'sdfg',
sv_cid:'dfg',
sv_pubid:'xcv',
sv_domain:'zxv'
}
,
storage: {
type: "html5",
name: "merkleId",
expires: 30
type: "html5",
name: "merkleId",
expires: 30
},

},{
Expand Down
5 changes: 4 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
"zeotapIdPlusIdSystem",
"haloIdSystem",
"quantcastIdSystem",
"nextrollIdSystem",
"idxIdSystem",
"fabrickIdSystem",
"verizonMediaIdSystem",
"pubProvidedIdSystem",
"mwOpenLinkIdSystem",
"tapadIdSystem",
"novatiqIdSystem"
"novatiqIdSystem",
"uid2IdSystem",
"admixerIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
Expand Down
14 changes: 7 additions & 7 deletions modules/adheseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const spec = {
const payload = {
slots: slots,
parameters: commonParams,
vastContentAsUrl: true,
user: {
ext: {
eids: getEids(validBidRequests),
Expand Down Expand Up @@ -95,7 +96,7 @@ function adResponse(bid, ad) {

const bidResponse = getbaseAdResponse({
requestId: bid.bidId,
mediaType: getMediaType(markup),
mediaType: ad.extension.mediaType,
cpm: Number(price.amount),
currency: price.currency,
width: Number(ad.width),
Expand All @@ -110,7 +111,11 @@ function adResponse(bid, ad) {
});

if (bidResponse.mediaType === VIDEO) {
bidResponse.vastXml = markup;
if (ad.cachedBodyUrl) {
bidResponse.vastUrl = ad.cachedBodyUrl
} else {
bidResponse.vastXml = markup;
}
} else {
const counter = ad.impressionCounter ? "<img src='" + ad.impressionCounter + "' style='height:1px; width:1px; margin: -1px -1px; display:none;'/>" : '';
bidResponse.ad = markup + counter;
Expand Down Expand Up @@ -172,11 +177,6 @@ function isAdheseAd(ad) {
return !ad.origin || ad.origin === 'JERLICIA';
}

function getMediaType(markup) {
const isVideo = markup.trim().toLowerCase().match(/<\?xml|<vast/);
return isVideo ? VIDEO : BANNER;
}

function getAdMarkup(ad) {
if (!isAdheseAd(ad) || (ad.ext === 'js' && ad.body !== undefined && ad.body !== '' && ad.body.match(/<script|<SCRIPT|<html|<HTML|<\?xml/))) {
return ad.body
Expand Down
29 changes: 25 additions & 4 deletions modules/adkernelAdnAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import CONSTANTS from '../src/constants.json';
import adapterManager from '../src/adapterManager.js';
import * as utils from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {config} from '../src/config.js';

const ANALYTICS_VERSION = '1.0.1';
const GVLID = 14;
const ANALYTICS_VERSION = '1.0.2';
const DEFAULT_QUEUE_TIMEOUT = 4000;
const DEFAULT_HOST = 'tag.adkernel.com';
const storageObj = getStorageManager();
const storageObj = getStorageManager(GVLID);

const ADK_HB_EVENTS = {
AUCTION_INIT: 'auctionInit',
Expand All @@ -34,6 +36,7 @@ function buildRequestTemplate(pubId) {
},
lang: navigator.language
},
user: {},
src: getUmtSource(loc.href, ref)
}
}
Expand All @@ -50,6 +53,7 @@ let analyticsAdapter = Object.assign(adapter({analyticsType: 'endpoint'}),
if (analyticsAdapter.context.queue) {
analyticsAdapter.context.queue.init();
}
initPrivacy(analyticsAdapter.context.requestTemplate, args.bidderRequests);
handler = trackAuctionInit;
break;
case CONSTANTS.EVENTS.BID_REQUESTED:
Expand Down Expand Up @@ -100,7 +104,8 @@ analyticsAdapter.enableAnalytics = (config) => {

adapterManager.registerAnalyticsAdapter({
adapter: analyticsAdapter,
code: 'adkernelAdn'
code: 'adkernelAdn',
gvlid: GVLID
});

export default analyticsAdapter;
Expand Down Expand Up @@ -390,3 +395,19 @@ function getLocationAndReferrer(win) {
loc: win.location
};
}

function initPrivacy(template, requests) {
let consent = requests[0].gdprConsent;
if (consent && consent.gdprApplies) {
template.user.gdpr = ~~consent.gdprApplies;
}
if (consent && consent.consentString) {
template.user.gdpr_consent = consent.consentString;
}
if (requests[0].uspConsent) {
template.user.us_privacy = requests[0].uspConsent;
}
if (config.getConfig('coppa')) {
template.user.coppa = 1;
}
}
6 changes: 6 additions & 0 deletions modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';

const DEFAULT_ADKERNEL_DSP_DOMAIN = 'tag.adkernel.com';
const DEFAULT_MIMES = ['video/mp4', 'video/webm', 'application/x-shockwave-flash', 'application/javascript'];
const DEFAULT_PROTOCOLS = [2, 3, 5, 6];
const DEFAULT_APIS = [1, 2];
const GVLID = 14;

function isRtbDebugEnabled(refInfo) {
return refInfo.referer.indexOf('adk_debug=true') !== -1;
Expand Down Expand Up @@ -67,6 +69,9 @@ function buildRequestParams(tags, bidderRequest) {
if (uspConsent) {
utils.deepSetValue(req, 'user.us_privacy', uspConsent);
}
if (config.getConfig('coppa')) {
utils.deepSetValue(req, 'user.coppa', 1);
}
return req;
}

Expand Down Expand Up @@ -110,6 +115,7 @@ function buildBid(tag) {

export const spec = {
code: 'adkernelAdn',
gvlid: GVLID,
supportedMediaTypes: [BANNER, VIDEO],
aliases: ['engagesimply'],

Expand Down
Loading

0 comments on commit e7b5d01

Please sign in to comment.