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

Commit

Permalink
Merge pull request prebid#27 in AOLP_ADS_JS/prebid.js from release/1.…
Browse files Browse the repository at this point in the history
…1.0 to master

* commit '0f80914cf4c0dfc9c05637d63b27e70098ef6e5c':
  Finilized 1.1.0
  Bumped RC version to 1.1.0-rc2
  Refactorred default parameters logic in AOL analytics
  Revert "Long template string broken into multiple lines"
  Long template string broken into multiple lines
  Added unit tests for including pixels from pubapi response
  Refactoring
  Fixed unit tests for AOL analytics
  Included curency in hbevent requests
  Added unit tests for AOL adapter
  Temporarily excluded broken unit tests for AOL analytics
  Fixed unit test setup
  Optimized AOL adapter and reduced in size
  • Loading branch information
marian-r committed Sep 16, 2016
2 parents f4b0170 + 0f80914 commit 7812b06
Show file tree
Hide file tree
Showing 9 changed files with 474 additions and 1,988 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
AOL Prebid 1.1.0
----------------
AOL adapter is optimized and heavily reduced in size.
Small code optimizations in AOL analytics adapter.
AOL analytics adapter now includes currency in the hbevent requests.


AOL Prebid 1.0.7
----------------
BUGFIX: AOL analytics adapter reports timed out bids.
Expand Down
7 changes: 7 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ gulp.task('webpack', function () {

webpackConfig.devtool = null;

webpackConfig.module.loaders = webpackConfig.module.loaders.concat([{
test: /adapters/,
include: /(src)/,
exclude: /(adapter.js|baseAdapter.js|analytics)/,
loader: 'delimiterLoader'
}]);

const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
return gulp.src([].concat(analyticsSources, 'src/prebid.js'))
.pipe(webpack(webpackConfig))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aol-container-tag",
"version": "1.0.7",
"version": "1.1.0",
"description": "AOL Header Bidding Container Tag Library",
"main": "src/prebid.js",
"scripts": {
Expand Down
17 changes: 9 additions & 8 deletions src/adapters/analytics/aol.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const EVENTS = {

let adUnits = {};

let baseSchemaTemplate = template `${'protocol'}://${'host'}${('port') ? `:${'port'}` : ``}/hbevent/${'tagversion'}/${'network'}/${ ('subnetwork')?`${'subnetwork'}/`:``}${'placement'}/${'site'}/${'eventid'}/hbeventts=${'hbeventts'};cors=yes`;
let auctionSchemaTemplate = template `;pubadid=${'pubadid'};hbauctionid=${'hbauctionid'};hbwinner=${'hbwinner'};hbprice=${'hbprice'};${ ('hbcur') ? `hbcur=${'hbcur'};` : ``}pubapi=${'pubapi'}`;
let baseSchemaTemplate = template `${'protocol'}://${'host'}/hbevent/${'tagversion'}/${'network'}/${'placement'}/${'site'}/${'eventid'}/hbeventts=${'hbeventts'};cors=yes`;
let auctionSchemaTemplate = template `;pubadid=${'pubadid'};hbauctionid=${'hbauctionid'};hbwinner=${'hbwinner'};hbprice=${'hbprice'}${'hbcur'}${'pubapi'}`;
let winSchemaTemplate = template `;hbauctioneventts=${'hbauctioneventts'};pubadid=${'pubadid'};hbauctionid=${'hbauctionid'};hbwinner=${'hbwinner'};pubcpm=${'pubcpm'}`;
let bidderSchemaTemplate = template `;hbbidder=${'hbbidder'};hbbid=${'hbbid'};hbstatus=${'hbstatus'};hbtime=${'hbtime'}`;

Expand All @@ -48,7 +48,7 @@ export default utils.extend(adapter({
server: null // Internal use only. Use 'region' config option for AOL adapter.
}
}) {
this.server = options.server;
this.server = options ? options.server : null;

//first send all events fired before enableAnalytics called
events.getEvents().forEach(event => {
Expand Down Expand Up @@ -145,10 +145,8 @@ export default utils.extend(adapter({
return {
protocol: (document.location.protocol === 'https:') ? 'https' : 'http',
host: this.server || serverMap[aolParams.region] || serverMap.us,
port: aolParams.port || '',
tagversion: '3.0',
network: aolParams.network || '',
subnetwork: aolParams.subnetwork || '',
placement: aolParams.placement,
site: aolParams.pageid || 0,
eventid: eventId,
Expand All @@ -163,8 +161,8 @@ export default utils.extend(adapter({
hbauctionid: generateAuctionId(aolParams.placement),
hbwinner: adUnit.winner.bidder ? getBidderId(adUnit.winner.bidder) : 0,
hbprice: adUnit.winner.cpm || 0,
hbcur: '',
pubapi: aolParams.pubapiId
hbcur: aolParams.currencyCode ? `;hbcur=${aolParams.currencyCode}` : '',
pubapi: aolParams.pubapiId ? `;pubapi=${aolParams.pubapiId}` : ''
};
},

Expand Down Expand Up @@ -286,14 +284,17 @@ function addAolParams(adUnit, adUnitsConf, bidsReceived) {
const filteredBids = bidsReceived.filter(
bid => bid.bidderCode === AOL_BIDDER_CODE && bid.adUnitCode === adUnit.code
);
const pubapiId = (filteredBids.length === 1) ? filteredBids[0].pubapiId : '';
const onlyOneBid = filteredBids.length === 1;
const pubapiId = (onlyOneBid) ? filteredBids[0].pubapiId : '';
const currencyCode = (onlyOneBid) ? filteredBids[0].currencyCode : '';

for (let adUnitConf of adUnitsConf) {
if (adUnitConf.code === adUnit.code) {
for (let adUnitBid of adUnitConf.bids) {
if (adUnitBid.bidder === AOL_BIDDER_CODE) {
adUnit.aolParams = adUnitBid.params;
adUnit.aolParams.pubapiId = pubapiId;
adUnit.aolParams.currencyCode = currencyCode;
}
}
}
Expand Down

0 comments on commit 7812b06

Please sign in to comment.