Skip to content

Commit e7b5d01

Browse files
authored
Merge pull request #3 from prebid/master
merge master
2 parents 078473b + b352c7d commit e7b5d01

File tree

77 files changed

+3922
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3922
-459
lines changed

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function test(done) {
286286
} else {
287287
var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file);
288288

289-
var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase);
289+
var browserOverride = helpers.parseBrowserArgs(argv);
290290
if (browserOverride.length > 0) {
291291
karmaConf.browsers = browserOverride;
292292
}

integrationExamples/gpt/adloox.html

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Prebid Display/Video Merged Auction with Adloox Integration</title>
5+
6+
<script async src="http://localhost:9999/build/dev/prebid.js"></script>
7+
<!-- <script async src="https://storage.googleapis.com/adloox-ads-js-test/prebid.js"></script> -->
8+
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
9+
10+
<script>
11+
// set to 10s (rather than 100ms) only to assist development as 'Local Overrides' stalls for >1s :-/
12+
var AUCTION_DELAY = 10000; // recommended to be set to 100 in production
13+
var PREBID_TIMEOUT = 1000;
14+
var FAILSAFE_TIMEOUT = AUCTION_DELAY + (3 * PREBID_TIMEOUT);
15+
16+
var div_1_sizes = [ [728, 90] ];
17+
var div_2_sizes = [ [300, 250] ];
18+
var video_1_size = [ 640, 480 ];
19+
20+
var adUnits = [
21+
{
22+
code: 'div-1',
23+
mediaTypes: {
24+
banner: {
25+
sizes: div_1_sizes
26+
}
27+
},
28+
bids: [
29+
{
30+
bidder: 'rubicon',
31+
params: {
32+
accountId: 14062,
33+
siteId: 70608,
34+
zoneId: 498816
35+
}
36+
}
37+
]
38+
},
39+
{
40+
code: 'div-2',
41+
mediaTypes: {
42+
banner: {
43+
sizes: div_2_sizes
44+
}
45+
},
46+
bids: [
47+
{
48+
bidder: 'rubicon',
49+
params: {
50+
accountId: 14062,
51+
siteId: 70608,
52+
zoneId: 498816
53+
}
54+
}
55+
]
56+
}
57+
];
58+
59+
var videoAdUnit = {
60+
code: 'video-1',
61+
mediaTypes: {
62+
video: {
63+
context: 'instream',
64+
playerSize: [ 640, 480 ]
65+
}
66+
},
67+
fpd: {
68+
context: {
69+
pbAdSlot: '/19968336/prebid_cache_video_adunit'
70+
}
71+
},
72+
bids: [
73+
{
74+
bidder: 'spotx',
75+
params: {
76+
channel_id: 85394,
77+
ad_unit: 'instream'
78+
}
79+
}
80+
]
81+
};
82+
83+
window.googletag = window.googletag || { cmd: [] };
84+
googletag.cmd.push(function() {
85+
googletag
86+
.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1')
87+
.addService(googletag.pubads());
88+
googletag
89+
.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2')
90+
.addService(googletag.pubads());
91+
googletag.pubads().disableInitialLoad();
92+
googletag.pubads().enableSingleRequest();
93+
googletag.enableServices();
94+
});
95+
96+
var pbjs = pbjs || {};
97+
pbjs.que = pbjs.que || [];
98+
99+
var tempTag = false;
100+
var invokeVideoPlayer = function(url) {
101+
tempTag = url;
102+
};
103+
104+
function sendAdserverRequest(bids, timedOut, auctionId) {
105+
if (pbjs.initAdserverSet) return;
106+
pbjs.initAdserverSet = true;
107+
108+
googletag.cmd.push(function() {
109+
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(adUnits);
110+
googletag.pubads().refresh();
111+
});
112+
113+
var videoBids = bids[videoAdUnit.code];
114+
if (videoBids) {
115+
var videoUrl = videoBids.bids[0].vastUrl;
116+
// var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
117+
// adUnit: videoAdUnit,
118+
// params: {
119+
// iu: '/19968336/prebid_cache_video_adunit',
120+
// cust_params: {
121+
// section: 'blog',
122+
// anotherKey: 'anotherValue'
123+
// },
124+
// output: 'vast'
125+
// }
126+
// });
127+
invokeVideoPlayer(videoUrl);
128+
}
129+
}
130+
131+
// optionally wrap with googletag to have gpt-pre-auction
132+
// automatically populate Prebid Ad Slot (pbAdSlot)
133+
// https://docs.prebid.org/dev-docs/modules/gpt-pre-auction.html
134+
// alternatively remove wrapping and set AdUnit.fpd.context.pbAdSlot
135+
googletag.cmd.push(function() {
136+
pbjs.que.push(function() {
137+
pbjs.setConfig({
138+
instreamTracking: {
139+
enabled: true
140+
},
141+
rubicon: {
142+
singleRequest: true
143+
}
144+
});
145+
pbjs.enableAnalytics({
146+
provider: 'adloox',
147+
options: {
148+
client: 'adlooxtest',
149+
clientid: 127,
150+
platformid: 0,
151+
tagid: 0
152+
}
153+
});
154+
pbjs.addAdUnits(adUnits);
155+
pbjs.addAdUnits(videoAdUnit);
156+
pbjs.requestBids({
157+
bidsBackHandler: sendAdserverRequest,
158+
timeout: PREBID_TIMEOUT
159+
})
160+
});
161+
});
162+
163+
setTimeout(function() {
164+
sendAdserverRequest();
165+
}, FAILSAFE_TIMEOUT);
166+
</script>
167+
</head>
168+
<body>
169+
<h1>Prebid Display/Video Merged Auction with Adloox Integration</h1>
170+
171+
<h2>div-1</h2>
172+
<div id="div-1">
173+
<script>
174+
googletag.cmd.push(function() {
175+
googletag.display('div-1');
176+
});
177+
</script>
178+
</div>
179+
180+
<h2>div-2</h2>
181+
<div id="div-2">
182+
<script>
183+
googletag.cmd.push(function() {
184+
googletag.display('div-2');
185+
});
186+
</script>
187+
</div>
188+
189+
<h2>video-1</h2>
190+
<div id="video-1"></div>
191+
<script src="https://content.jwplatform.com/libraries/72xIKEe6.js"></script>
192+
<script>
193+
var playerInstance = jwplayer('video-1');
194+
invokeVideoPlayer = function(url) {
195+
playerInstance.setup({
196+
"playlist": "https://content.jwplatform.com/feeds/ae4tmw2D.json",
197+
"width": 640,
198+
"height": 480,
199+
"advertising": {
200+
"client": "vast",
201+
"tag": url
202+
}
203+
});
204+
};
205+
if (tempTag) {
206+
invokeVideoPlayer(tempTag);
207+
tempTag = false;
208+
}
209+
</script>
210+
</body>
211+
</html>

integrationExamples/gpt/userId_example.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,16 @@
197197
}, {
198198
name: "merkleId",
199199
params: {
200-
ptk: '12345678-aaaa-bbbb-cccc-123456789abc', //Set your real merkle partner key here
201-
pubid: 'EXAMPLE' //Set your real merkle publisher id here
202-
},
200+
vendor:'sdfg',
201+
sv_cid:'dfg',
202+
sv_pubid:'xcv',
203+
sv_domain:'zxv'
204+
}
205+
,
203206
storage: {
204-
type: "html5",
205-
name: "merkleId",
206-
expires: 30
207+
type: "html5",
208+
name: "merkleId",
209+
expires: 30
207210
},
208211

209212
},{

modules/.submodules.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
"zeotapIdPlusIdSystem",
1717
"haloIdSystem",
1818
"quantcastIdSystem",
19+
"nextrollIdSystem",
1920
"idxIdSystem",
2021
"fabrickIdSystem",
2122
"verizonMediaIdSystem",
2223
"pubProvidedIdSystem",
2324
"mwOpenLinkIdSystem",
2425
"tapadIdSystem",
25-
"novatiqIdSystem"
26+
"novatiqIdSystem",
27+
"uid2IdSystem",
28+
"admixerIdSystem"
2629
],
2730
"adpod": [
2831
"freeWheelAdserverVideo",

modules/adheseBidAdapter.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const spec = {
3434
const payload = {
3535
slots: slots,
3636
parameters: commonParams,
37+
vastContentAsUrl: true,
3738
user: {
3839
ext: {
3940
eids: getEids(validBidRequests),
@@ -95,7 +96,7 @@ function adResponse(bid, ad) {
9596

9697
const bidResponse = getbaseAdResponse({
9798
requestId: bid.bidId,
98-
mediaType: getMediaType(markup),
99+
mediaType: ad.extension.mediaType,
99100
cpm: Number(price.amount),
100101
currency: price.currency,
101102
width: Number(ad.width),
@@ -110,7 +111,11 @@ function adResponse(bid, ad) {
110111
});
111112

112113
if (bidResponse.mediaType === VIDEO) {
113-
bidResponse.vastXml = markup;
114+
if (ad.cachedBodyUrl) {
115+
bidResponse.vastUrl = ad.cachedBodyUrl
116+
} else {
117+
bidResponse.vastXml = markup;
118+
}
114119
} else {
115120
const counter = ad.impressionCounter ? "<img src='" + ad.impressionCounter + "' style='height:1px; width:1px; margin: -1px -1px; display:none;'/>" : '';
116121
bidResponse.ad = markup + counter;
@@ -172,11 +177,6 @@ function isAdheseAd(ad) {
172177
return !ad.origin || ad.origin === 'JERLICIA';
173178
}
174179

175-
function getMediaType(markup) {
176-
const isVideo = markup.trim().toLowerCase().match(/<\?xml|<vast/);
177-
return isVideo ? VIDEO : BANNER;
178-
}
179-
180180
function getAdMarkup(ad) {
181181
if (!isAdheseAd(ad) || (ad.ext === 'js' && ad.body !== undefined && ad.body !== '' && ad.body.match(/<script|<SCRIPT|<html|<HTML|<\?xml/))) {
182182
return ad.body

modules/adkernelAdnAnalyticsAdapter.js

+25-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import CONSTANTS from '../src/constants.json';
33
import adapterManager from '../src/adapterManager.js';
44
import * as utils from '../src/utils.js';
55
import {ajax} from '../src/ajax.js';
6-
import { getStorageManager } from '../src/storageManager.js';
6+
import {getStorageManager} from '../src/storageManager.js';
7+
import {config} from '../src/config.js';
78

8-
const ANALYTICS_VERSION = '1.0.1';
9+
const GVLID = 14;
10+
const ANALYTICS_VERSION = '1.0.2';
911
const DEFAULT_QUEUE_TIMEOUT = 4000;
1012
const DEFAULT_HOST = 'tag.adkernel.com';
11-
const storageObj = getStorageManager();
13+
const storageObj = getStorageManager(GVLID);
1214

1315
const ADK_HB_EVENTS = {
1416
AUCTION_INIT: 'auctionInit',
@@ -34,6 +36,7 @@ function buildRequestTemplate(pubId) {
3436
},
3537
lang: navigator.language
3638
},
39+
user: {},
3740
src: getUmtSource(loc.href, ref)
3841
}
3942
}
@@ -50,6 +53,7 @@ let analyticsAdapter = Object.assign(adapter({analyticsType: 'endpoint'}),
5053
if (analyticsAdapter.context.queue) {
5154
analyticsAdapter.context.queue.init();
5255
}
56+
initPrivacy(analyticsAdapter.context.requestTemplate, args.bidderRequests);
5357
handler = trackAuctionInit;
5458
break;
5559
case CONSTANTS.EVENTS.BID_REQUESTED:
@@ -100,7 +104,8 @@ analyticsAdapter.enableAnalytics = (config) => {
100104

101105
adapterManager.registerAnalyticsAdapter({
102106
adapter: analyticsAdapter,
103-
code: 'adkernelAdn'
107+
code: 'adkernelAdn',
108+
gvlid: GVLID
104109
});
105110

106111
export default analyticsAdapter;
@@ -390,3 +395,19 @@ function getLocationAndReferrer(win) {
390395
loc: win.location
391396
};
392397
}
398+
399+
function initPrivacy(template, requests) {
400+
let consent = requests[0].gdprConsent;
401+
if (consent && consent.gdprApplies) {
402+
template.user.gdpr = ~~consent.gdprApplies;
403+
}
404+
if (consent && consent.consentString) {
405+
template.user.gdpr_consent = consent.consentString;
406+
}
407+
if (requests[0].uspConsent) {
408+
template.user.us_privacy = requests[0].uspConsent;
409+
}
410+
if (config.getConfig('coppa')) {
411+
template.user.coppa = 1;
412+
}
413+
}

modules/adkernelAdnBidAdapter.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as utils from '../src/utils.js';
22
import {registerBidder} from '../src/adapters/bidderFactory.js';
33
import {BANNER, VIDEO} from '../src/mediaTypes.js';
4+
import {config} from '../src/config.js';
45

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

1012
function isRtbDebugEnabled(refInfo) {
1113
return refInfo.referer.indexOf('adk_debug=true') !== -1;
@@ -67,6 +69,9 @@ function buildRequestParams(tags, bidderRequest) {
6769
if (uspConsent) {
6870
utils.deepSetValue(req, 'user.us_privacy', uspConsent);
6971
}
72+
if (config.getConfig('coppa')) {
73+
utils.deepSetValue(req, 'user.coppa', 1);
74+
}
7075
return req;
7176
}
7277

@@ -110,6 +115,7 @@ function buildBid(tag) {
110115

111116
export const spec = {
112117
code: 'adkernelAdn',
118+
gvlid: GVLID,
113119
supportedMediaTypes: [BANNER, VIDEO],
114120
aliases: ['engagesimply'],
115121

0 commit comments

Comments
 (0)