Skip to content
This repository was archived by the owner on Feb 13, 2021. It is now read-only.

Commit ae0895f

Browse files
committed
Merge pull request prebid#128 in AOLP_ADS_JS/prebid.js from release/1.30.0 to aolgithub-master
* commit '5a8d2bf93ee15071a78e24ac976103cacf3c6021': (35 commits) Added changelog entry. Prebid 0.30.1 Release Remove undefined variable usage (prebid#1662) fixes bug for IE when invalid value passed to parse (prebid#1657) Aliasbidder fix (prebid#1652) prebidAdapter secure support (prebid#1655) Increment pre version Prebid 0.30.0 Release Add native param support to mediaTypes (prebid#1625) PulsePoint Lite adpater changes (prebid#1630) Appnexus ast unittest updates (prebid#1654) Support aspect ratio specification for native images (prebid#1634) Revert changes for switch between client side and server side. (prebid#1653) rubicon converted to bidderFactory (prebid#1624) Add JSDoc for `pbjs.getAllWinningBids` (prebid#1566) Add ignore-loader to handle .md files (prebid#1646) fixed PBS cookie syncs (prebid#1637) Add placementId request param to Yieldmo bid adapter (prebid#1632) Adxcg analytics adapter (prebid#1599) Add publisher sub-id support to the Criteo adapter (prebid#1629) ...
2 parents 71d8747 + 5a8d2bf commit ae0895f

Some content is hidden

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

54 files changed

+2157
-1327
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
## Steps to reproduce
88
<!--
9-
If this is a bug, please provide a list of steps to reproduce the issue and
10-
if possible a link to a test page or minimal demo of the problem via
9+
If this is a bug, please provide a list of steps to reproduce the issue
10+
-->
11+
12+
## Test page
13+
<!--
14+
Include a link to a test page or minimal demo of the problem via
1115
https://jsfiddle.net, http://jsbin.com or similar.
1216
-->
1317

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
AOL Prebid 1.30.0
2+
----------------
3+
Updated to Prebid 0.30.1
4+
5+
16
AOL Prebid 1.29.0
27
----------------
38
Updated to Prebid 0.29.0

gulpfile.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,22 @@ function bundle(dev, moduleArr) {
8787

8888
var entries = [helpers.getBuiltPrebidCoreFile(dev)].concat(helpers.getBuiltModules(dev, modules));
8989

90+
var outputFileName = argv.bundleName ? argv.bundleName : 'prebid.js';
91+
92+
// change output filename if argument --tag given
93+
if (argv.tag && argv.tag.length) {
94+
outputFileName = outputFileName.replace(/\.js$/, `.${argv.tag}.js`);
95+
}
96+
9097
gutil.log('Concatenating files:\n', entries);
9198
gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
99+
gutil.log('Generating bundle:', outputFileName);
92100

93101
return gulp.src(
94102
entries
95103
)
96104
.pipe(gulpif(dev, sourcemaps.init({loadMaps: true})))
97-
.pipe(concat(argv.bundleName ? argv.bundleName : 'prebid.js'))
105+
.pipe(concat(outputFileName))
98106
.pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', {
99107
global: prebid.globalVarName
100108
}
@@ -141,11 +149,6 @@ gulp.task('devpack', ['clean'], function () {
141149
gulp.task('webpack', ['clean'], function () {
142150
var cloned = _.cloneDeep(webpackConfig);
143151

144-
// change output filename if argument --tag given
145-
if (argv.tag && argv.tag.length) {
146-
cloned.output.filename = 'prebid.' + argv.tag + '.js';
147-
}
148-
149152
delete cloned.devtool;
150153

151154
var externalModules = helpers.getArgModules();

integrationExamples/gpt/pbjs_example_gpt.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@
340340
},
341341
{
342342
bidder: 'yieldmo',
343-
params: {}
343+
params: {
344+
placementId: 'ym_12341234' // Optional Yieldmo Placement ID
345+
}
344346
},
345347
{
346348
bidder: 'adequant',

integrationExamples/gpt/pbjs_ucfunnel_gpt.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
bids: [{
1414
bidder: 'ucfunnel',
1515
params: {
16-
adid: "test-ad-83444226E44368D1E32E49EEBE6D29", //String - required
17-
width: 300,
18-
height: 250
16+
adid: "test-ad-83444226E44368D1E32E49EEBE6D29" //String - required
1917
}
2018
}
2119
]

integrationExamples/gpt/pbjs_video_adUnit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
var videoAdUnit = {
3737
code: 'video1',
3838
sizes: [640,480],
39-
mediaType: 'video',
39+
mediaTypes: { video: {} },
4040
bids: [
4141
{
4242
bidder: 'appnexusAst',

modules/adomikAnalyticsAdapter.js

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
import adapter from 'src/AnalyticsAdapter';
2+
import CONSTANTS from 'src/constants.json';
3+
import adaptermanager from 'src/adaptermanager';
4+
// import utils from 'src/utils';
5+
6+
// Events used in adomik analytics adapter
7+
const auctionInit = CONSTANTS.EVENTS.AUCTION_INIT;
8+
const auctionEnd = CONSTANTS.EVENTS.AUCTION_END;
9+
const bidRequested = CONSTANTS.EVENTS.BID_REQUESTED;
10+
const bidResponse = CONSTANTS.EVENTS.BID_RESPONSE;
11+
const bidWon = CONSTANTS.EVENTS.BID_WON;
12+
const bidTimeout = CONSTANTS.EVENTS.BID_TIMEOUT;
13+
14+
let bidwonTimeout = 1000;
15+
16+
let adomikAdapter = Object.assign(adapter({}),
17+
{
18+
// Track every event needed
19+
track({ eventType, args }) {
20+
switch (eventType) {
21+
case auctionInit:
22+
adomikAdapter.currentContext.id = args.requestId
23+
adomikAdapter.currentContext.timeout = args.timeout
24+
if (args.config.bidwonTimeout !== undefined && typeof args.config.bidwonTimeout === 'number') {
25+
bidwonTimeout = args.config.bidwonTimeout;
26+
}
27+
break;
28+
29+
case bidTimeout:
30+
adomikAdapter.currentContext.timeouted = true;
31+
break;
32+
33+
case bidResponse:
34+
adomikAdapter.bucketEvents.push({
35+
type: 'response',
36+
event: adomikAdapter.buildBidResponse(args)
37+
});
38+
break;
39+
40+
case bidWon:
41+
adomikAdapter.bucketEvents.push({
42+
type: 'winner',
43+
event: {
44+
id: args.adId,
45+
placementCode: args.adUnitCode
46+
}
47+
});
48+
break;
49+
50+
case bidRequested:
51+
args.bids.forEach(function(bid) {
52+
adomikAdapter.bucketEvents.push({
53+
type: 'request',
54+
event: {
55+
bidder: bid.bidder.toUpperCase(),
56+
placementCode: bid.placementCode
57+
}
58+
});
59+
});
60+
break;
61+
62+
case auctionEnd:
63+
setTimeout(() => {
64+
if (adomikAdapter.bucketEvents.length > 0) {
65+
adomikAdapter.sendTypedEvent();
66+
}
67+
}, bidwonTimeout);
68+
break;
69+
}
70+
}
71+
}
72+
);
73+
74+
adomikAdapter.sendTypedEvent = function() {
75+
const groupedTypedEvents = adomikAdapter.buildTypedEvents();
76+
77+
const bulkEvents = {
78+
uid: adomikAdapter.currentContext.uid,
79+
ahbaid: adomikAdapter.currentContext.id,
80+
timeout: adomikAdapter.currentContext.timeout,
81+
hostname: window.location.hostname,
82+
eventsByPlacementCode: groupedTypedEvents.map(function(typedEventsByType) {
83+
let sizes = [];
84+
const eventKeys = ['request', 'response', 'winner'];
85+
let events = {};
86+
87+
eventKeys.forEach((eventKey) => {
88+
events[`${eventKey}s`] = [];
89+
if (typedEventsByType[eventKey] !== undefined) {
90+
typedEventsByType[eventKey].forEach((typedEvent) => {
91+
if (typedEvent.event.size !== undefined) {
92+
const size = adomikAdapter.sizeUtils.handleSize(sizes, typedEvent.event.size);
93+
if (size !== null) {
94+
sizes = [...sizes, size];
95+
}
96+
}
97+
events[`${eventKey}s`] = [...events[`${eventKey}s`], typedEvent.event];
98+
});
99+
}
100+
});
101+
102+
return {
103+
placementCode: typedEventsByType.placementCode,
104+
sizes,
105+
events
106+
};
107+
})
108+
};
109+
110+
// Encode object in base64
111+
const encodedBuf = window.btoa(JSON.stringify(bulkEvents));
112+
113+
// Create final url and split it in 1600 characters max (+endpoint length)
114+
const encodedUri = encodeURIComponent(encodedBuf);
115+
const splittedUrl = encodedUri.match(/.{1,1600}/g);
116+
117+
splittedUrl.forEach((split, i) => {
118+
const partUrl = `${split}&id=${adomikAdapter.currentContext.id}&part=${i}&on=${splittedUrl.length - 1}`;
119+
const img = new Image(1, 1);
120+
img.src = 'https://' + adomikAdapter.currentContext.url + '/?q=' + partUrl;
121+
})
122+
};
123+
124+
adomikAdapter.buildBidResponse = function (bid) {
125+
return {
126+
bidder: bid.bidderCode.toUpperCase(),
127+
placementCode: bid.adUnitCode,
128+
id: bid.adId,
129+
status: (bid.statusMessage === 'Bid available') ? 'VALID' : 'EMPTY_OR_ERROR',
130+
cpm: parseFloat(bid.cpm),
131+
size: {
132+
width: Number(bid.width),
133+
height: Number(bid.height)
134+
},
135+
timeToRespond: bid.timeToRespond,
136+
afterTimeout: adomikAdapter.currentContext.timeouted
137+
};
138+
}
139+
140+
adomikAdapter.sizeUtils = {
141+
sizeAlreadyExists: (sizes, typedEventSize) => {
142+
return sizes.find((size) => size.height === typedEventSize.height && size.width === typedEventSize.width);
143+
},
144+
formatSize: (typedEventSize) => {
145+
return {
146+
width: Number(typedEventSize.width),
147+
height: Number(typedEventSize.height)
148+
};
149+
},
150+
handleSize: (sizes, typedEventSize) => {
151+
let formattedSize = null;
152+
if (adomikAdapter.sizeUtils.sizeAlreadyExists(sizes, typedEventSize) === undefined) {
153+
formattedSize = adomikAdapter.sizeUtils.formatSize(typedEventSize);
154+
}
155+
return formattedSize;
156+
}
157+
};
158+
159+
adomikAdapter.buildTypedEvents = function () {
160+
const groupedTypedEvents = [];
161+
adomikAdapter.bucketEvents.forEach(function(typedEvent, i) {
162+
const [placementCode, type] = [typedEvent.event.placementCode, typedEvent.type];
163+
let existTypedEvent = groupedTypedEvents.findIndex((groupedTypedEvent) => groupedTypedEvent.placementCode === placementCode);
164+
165+
if (existTypedEvent === -1) {
166+
groupedTypedEvents.push({
167+
placementCode: placementCode,
168+
[type]: [typedEvent]
169+
});
170+
existTypedEvent = groupedTypedEvents.length - 1;
171+
}
172+
173+
if (groupedTypedEvents[existTypedEvent][type]) {
174+
groupedTypedEvents[existTypedEvent][type] = [...groupedTypedEvents[existTypedEvent][type], typedEvent];
175+
} else {
176+
groupedTypedEvents[existTypedEvent][type] = [typedEvent];
177+
}
178+
});
179+
180+
return groupedTypedEvents;
181+
}
182+
183+
// Initialize adomik object
184+
adomikAdapter.currentContext = {};
185+
adomikAdapter.bucketEvents = [];
186+
187+
adomikAdapter.adapterEnableAnalytics = adomikAdapter.enableAnalytics;
188+
189+
adomikAdapter.enableAnalytics = function (config) {
190+
const initOptions = config.options;
191+
if (initOptions) {
192+
adomikAdapter.currentContext = {
193+
uid: initOptions.id,
194+
url: initOptions.url,
195+
debug: initOptions.debug,
196+
id: '',
197+
timeouted: false,
198+
timeout: 0,
199+
}
200+
adomikAdapter.adapterEnableAnalytics(config);
201+
}
202+
};
203+
204+
adaptermanager.registerAnalyticsAdapter({
205+
adapter: adomikAdapter,
206+
code: 'adomik'
207+
});
208+
209+
export default adomikAdapter;

modules/adxcgAnalyticsAdapter.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import {ajax} from 'src/ajax';
2+
import adapter from 'src/AnalyticsAdapter';
3+
import adaptermanager from 'src/adaptermanager';
4+
import * as url from 'src/url';
5+
import * as utils from 'src/utils';
6+
7+
const emptyUrl = '';
8+
const analyticsType = 'endpoint';
9+
const adxcgAnalyticsVersion = 'v1.04';
10+
11+
let initOptions;
12+
let auctionTimestamp;
13+
let events = {
14+
bidRequests: [],
15+
bidResponses: []
16+
};
17+
18+
var adxcgAnalyticsAdapter = Object.assign(adapter(
19+
{
20+
emptyUrl,
21+
analyticsType
22+
}), {
23+
track({eventType, args}) {
24+
if (typeof args !== 'undefined') {
25+
if (eventType === 'bidTimeout') {
26+
events.bidTimeout = args;
27+
} else if (eventType === 'auctionInit') {
28+
events.auctionInit = args;
29+
auctionTimestamp = args.timestamp;
30+
} else if (eventType === 'bidRequested') {
31+
events.bidRequests.push(args);
32+
} else if (eventType === 'bidResponse') {
33+
events.bidResponses.push(mapBidResponse(args));
34+
} else if (eventType === 'bidWon') {
35+
send({
36+
bidWon: mapBidResponse(args)
37+
});
38+
}
39+
}
40+
41+
if (eventType === 'auctionEnd') {
42+
send(events);
43+
}
44+
}
45+
});
46+
47+
function mapBidResponse(bidResponse) {
48+
return {
49+
adUnitCode: bidResponse.adUnitCode,
50+
statusMessage: bidResponse.statusMessage,
51+
bidderCode: bidResponse.bidderCode,
52+
adId: bidResponse.adId,
53+
mediaType: bidResponse.mediaType,
54+
creative_id: bidResponse.creative_id,
55+
width: bidResponse.width,
56+
height: bidResponse.height,
57+
cpm: bidResponse.cpm,
58+
timeToRespond: bidResponse.timeToRespond
59+
};
60+
}
61+
62+
function send(data) {
63+
data.initOptions = initOptions;
64+
data.auctionTimestamp = auctionTimestamp;
65+
66+
let location = utils.getTopWindowLocation();
67+
let secure = location.protocol == 'https:';
68+
69+
let adxcgAnalyticsRequestUrl = url.format({
70+
protocol: secure ? 'https' : 'http',
71+
hostname: secure ? 'hbarxs.adxcg.net' : 'hbarx.adxcg.net',
72+
pathname: '/pbrx',
73+
search: {
74+
auctionTimestamp: auctionTimestamp,
75+
adxcgAnalyticsVersion: adxcgAnalyticsVersion,
76+
prebidVersion: $$PREBID_GLOBAL$$.version
77+
}
78+
});
79+
80+
ajax(adxcgAnalyticsRequestUrl, undefined, JSON.stringify(data), {method: 'POST'});
81+
}
82+
83+
adxcgAnalyticsAdapter.originEnableAnalytics = adxcgAnalyticsAdapter.enableAnalytics;
84+
adxcgAnalyticsAdapter.enableAnalytics = function (config) {
85+
initOptions = config.options;
86+
adxcgAnalyticsAdapter.originEnableAnalytics(config);
87+
};
88+
89+
adaptermanager.registerAnalyticsAdapter({
90+
adapter: adxcgAnalyticsAdapter,
91+
code: 'adxcg'
92+
});
93+
94+
export default adxcgAnalyticsAdapter;

0 commit comments

Comments
 (0)