Skip to content

Commit d07cd01

Browse files
jaiminpanchal27dluxemburg
authored andcommitted
Merge Prebid 1.0 to Master (prebid#1936)
* Concurrent auctions (prebid#1593) * Adding timestamp function to utils * Auction manager (WIP) * WIP * Updated targeting with auction instances and added auction status * Updated appnexus and appnexusAst adapter * Added done callback * Removing bidmanager functions * Removing deprecated public api functions * remove bidmanager file * Revert "remove bidmanager file" This reverts commit 616409e. * Updated appnexus and rubicon adapters to call done callback after all responses are back * Added todo * Fixing circular dependency * filter s2s requests * Emit auction end Add getBidsRequested function * remove unused stuff from adapters * cleanup and fixes * Unit test fixes Added exclude to karma temporarily to support unit tests * added setTimeout for each auction instance * added constants closer to code * binded auction object inside done method * Adding auctionmanager_spec tests and fixes * Remove breakpoint * Moving auction to separate file and unit tests * Merged manually * Merged config api changes * Passing adunits, adunitscodes via constructor and fixing unit tests * added ajax with timeout * convert targeting module to factory pattern * Auction code refactored and unit tests * Updated bidderfactory for 1.0 changes and added unit tests * Renamed placementCode to adUnitCode * Refactor auction and update unit tests * JSDoc for auction and auctionManager * Unit test fixes after rebase * Manual merge new updates to bidmanager and its spec file into auction * Update appnexusAst spec file * Refactor * Prebid 1.0 does not require no_bid to be added * removed side effect by cloning objects * bug fix to set status on already used bid * Removing all !1.0 complaiant adapters * Adding aliases to appnexusAst adapter * Removed bidmanager from currency * Add ignore-loader to handle .md files (prebid#1646) * Auction module refactor (prebid#1644) * Auction moduel refactor * remove comment and global cbtimeout * Config api updates (prebid#1633) * Add timeoutBuffer, s2sconfig, bidderSequence to config * Removing deprecated function and its unit test * fixed linting errors * Adapter/rubicon bid adapter markup (prebid#1674) * initial take on rubiconBidAdapter markup * formatting * formatting, cont. * formatting, cont. * Prebid 1.0 Fix issue with video bid validation (prebid#1680) * Fix issue with video bid validation * Modified tests to stub `auctionManager.getBidsRequested` instead of `getBidRequest` * Move stub to beforeEach hook * Fix lint errors * Add bidRequests param to bid validation * Auction module updated to support currency/hook (prebid#1733) * added hook module to prebid core that allows extension of arbitrary functions * remove unused dependency tiny-queue * change PluginFunction to HookedFunction * more hook documentation fixes * Auction module updated to support currency/hook * remove unused dependency tiny-queue * change PluginFunction to HookedFunction * more hook documentation fixes * WIP * allow context for hooked functions * added tests for context * remove withContext, just use bind * fix in hooks so asyncSeries keeps proper bound context * Unit test fixes * Updated bid validation function * Fixed video unit test * updated sizeMapping to use sizeConfig and support labels (prebid#1772) * updated sizeMapping to use sizeConfig and support labels * added new tests for labels and sizes w/ sizeConfig when making auction * made some names clearer and added type to labels for sizeMapping * make error message more descriptive in adaptermanager * remove extra line in adpatermanager * update package.json with correct version. (prebid#1813) * Unit test fixes for IE 10 and other old browsers (prebid#1810) * Added fix for location.origin * Fixed test case failing in IE and Safari browsers * Added utils.getOrigin method * Updated renderer to use hooks * Rename appnexusAst adapter to appnexus adapter (prebid#1848) * Renamed appnexusAst adapter to appnexus * Updated unit test to use appnexus bidderCode * Remove completed todo comment * fixed safeframe for 1.0 (prebid#1834) * Emit array of objects from BID_TIMEOUT event (prebid#1824) * Emit array of objects from BID_TIMEOUT event * requestId is now auctionId * Use v4 UUID to match previous requestId format * Move function * Move public winningBids to auction (prebid#1828) * Move public winningBids to auction * removed _winningBids * removed _winningBids * bugfix: return only new bids * Updates for PubWise Prebid 1.0 Support (prebid#1847) * Updates for Prebid 1.0 Support * Updates for Bug Fixes and a small refactor * update JSDoc comment. Remove trailing space (prebid#1872) tests were failing due to no trailing space eslint rule. * Prebid 1.0 adxcg analytics adapter fix for bidtimeout event (prebid#1871) * adxcg analytics adapter for 1.0 bidtimeout event * update tests for adxcg analytics 1.0 * Prebid 1.0 prebid server (prebid#1846) * fix adaptermanager s2sTest unit tests * fix s2s log message * remove errant comment * fixed log statement * removed seemingly unnecessary call to transformHeightWidth(adUnit); * removed legacy sizeMapping code block * initial refactor of prebidServerBidAdapter working w/o tests (cherry picked from commit 2b843d0) * add transformSizes back for prebidServer adUnits to fix request * fixed adapterManager_spec tests * added prebidServerBidAdapter tests for 1.0 * fixed lint errors * make sure addBidResponse and doneCb are stubbed for s2s calls * s2s requests now firing BID_REQUESTED event * fixed commented tests and other minor fixes * update defaults in prebidServerBidAdapter and fix doBidderSync bug * add new API for setting defaults in config for modules * Targeting updates (prebid#1689) * Cherry pick alias bidder * Cherry pick alias bidder * Cherry pick alias bidder * Updated test case to not import adapter * targeting updates * targeting functions refactoring * Refactored functions * more refactor of function * added jsdoc and some more refactor * check bid expiry and filtering used bids * make sure we have the right version * Update version to fix invalid semver * video bug fix (prebid#1906) * video bug fix added required params to prebidServerAdapter * Emitted auction_end and updated ttl for prebidServer * fix logging of server adapters * Manually merge bidManager code to auction module (prebid#1905) * Unit test fix in IE for adxcgAnalytics Adapter (prebid#1929) * IE bug fix * get only unique bidders * added log message for xhr timeout (prebid#1928) * remove polyfill.js and remove global polyfills (prebid#1918) * remove polyfill.js and remove global polyfills * make sure find, findIndex, and includes use core-js in tests * switch from virtual function bind core-js to explicit usage. * remove transform-function-bind babel plugin * Replace usePrebidCache with cache:url and remove default (prebid#1904) * replace usePrebidCache with video:cacheUrl and remove default * remove newConfig in dfpAdServerVideo_spec that isn't doing anything * change video.cacheUrl to cache.url * update to cache.url in auction and remove from adapter * pulsepointLiteBidAdapter renamed to pulsepointBidAdapter (prebid#1931) * ET-1691: Pulsepoint Analytics adapter for Prebid. (#1) * ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter * ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter * ET-1691: cleanup * ET-1691: minor * ET-1691: revert package.json change * Adding bidRequest to bidFactory.createBid method as per prebid#509 * ET-1765: Adding support for additional params in PulsePoint adapter (#2) * ET-1850: Fixing prebid#866 * Minor fix * Adding mandatory parameters to Bid * Pulsepoint adapter changes * readme updates * add 'x_source.tid' to rubicon requests (prebid#1933) * Bring in pre-1.0 native-image asset adapter change (prebid#1934) * 33Across Adapter: Removed the usage of utils library (prebid#1917) * Removed the usage of utils library to get bidder requests during userSync since this info will now be passed into the method * Fixed extra space which cause lint to fail * Implemented user sync per code review feedback in prebid#1917 * Minor feedback changes * Re-instated lint check for all files which was accidentally commited after testing * Prebid 1.0 server cache (prebid#1935) * add cache stuff to video for prebid server * add description for cacheMarkup
1 parent 903e70d commit d07cd01

File tree

194 files changed

+6020
-32816
lines changed

Some content is hidden

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

194 files changed

+6020
-32816
lines changed

.babelrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"presets": ["es2015"],
3-
"plugins": ["transform-object-assign", "transform-es3-property-literals", "transform-es3-member-expression-literals"]
3+
"plugins": [
4+
"transform-object-assign",
5+
"transform-es3-property-literals",
6+
"transform-es3-member-expression-literals"
7+
]
48
}

integrationExamples/gpt/hello_world.html

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -12,91 +12,91 @@
1212
-->
1313

1414
<html>
15-
<head>
16-
<script>
17-
var PREBID_TIMEOUT = 700;
18-
19-
var adUnits = [{
20-
code: 'div-gpt-ad-1460505748561-0',
21-
sizes: [[300, 250], [300,600]],
22-
23-
// Replace this object to test a new Adapter!
24-
bids: [{
25-
bidder: 'appnexus',
26-
params: {
27-
placementId: '10433394'
28-
}
29-
}]
30-
31-
}];
32-
33-
var pbjs = pbjs || {};
34-
pbjs.que = pbjs.que || [];
35-
36-
</script>
37-
38-
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
39-
<script>
40-
var googletag = googletag || {};
41-
googletag.cmd = googletag.cmd || [];
42-
googletag.cmd.push(function() {
43-
googletag.pubads().disableInitialLoad();
44-
});
45-
46-
pbjs.que.push(function() {
47-
pbjs.addAdUnits(adUnits);
48-
pbjs.requestBids({
49-
bidsBackHandler: sendAdserverRequest
50-
});
51-
});
52-
53-
function sendAdserverRequest() {
54-
if (pbjs.adserverRequestSent) return;
55-
pbjs.adserverRequestSent = true;
15+
<head>
16+
<script>
17+
var PREBID_TIMEOUT = 700;
18+
19+
var adUnits = [{
20+
code: 'div-gpt-ad-1460505748561-0',
21+
sizes: [[300, 250], [300,600]],
22+
23+
// Replace this object to test a new Adapter!
24+
bids: [{
25+
bidder: 'appnexusAst',
26+
params: {
27+
placementId: '10433394'
28+
}
29+
}]
30+
31+
}];
32+
33+
var pbjs = pbjs || {};
34+
pbjs.que = pbjs.que || [];
35+
36+
</script>
37+
38+
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
39+
<script>
40+
var googletag = googletag || {};
41+
googletag.cmd = googletag.cmd || [];
5642
googletag.cmd.push(function() {
57-
pbjs.que.push(function() {
58-
pbjs.setTargetingForGPTAsync();
59-
googletag.pubads().refresh();
43+
googletag.pubads().disableInitialLoad();
44+
});
45+
46+
pbjs.que.push(function() {
47+
pbjs.addAdUnits(adUnits);
48+
pbjs.requestBids({
49+
bidsBackHandler: sendAdserverRequest
6050
});
6151
});
62-
}
63-
64-
setTimeout(function() {
65-
sendAdserverRequest();
66-
}, PREBID_TIMEOUT);
67-
68-
</script>
69-
70-
<script>
71-
(function () {
72-
var gads = document.createElement('script');
73-
gads.async = true;
74-
gads.type = 'text/javascript';
75-
var useSSL = 'https:' == document.location.protocol;
76-
gads.src = (useSSL ? 'https:' : 'http:') +
77-
'//www.googletagservices.com/tag/js/gpt.js';
78-
var node = document.getElementsByTagName('script')[0];
79-
node.parentNode.insertBefore(gads, node);
80-
})();
81-
</script>
82-
83-
<script>
84-
googletag.cmd.push(function () {
85-
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
86-
87-
googletag.pubads().enableSingleRequest();
88-
googletag.enableServices();
89-
});
90-
</script>
91-
</head>
92-
93-
<body>
94-
<h2>Prebid.js Test</h2>
95-
<h5>Div-1</h5>
96-
<div id='div-gpt-ad-1460505748561-0'>
97-
<script type='text/javascript'>
98-
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
99-
</script>
100-
</div>
101-
</body>
102-
</html>
52+
53+
function sendAdserverRequest() {
54+
if (pbjs.adserverRequestSent) return;
55+
pbjs.adserverRequestSent = true;
56+
googletag.cmd.push(function() {
57+
pbjs.que.push(function() {
58+
pbjs.setTargetingForGPTAsync();
59+
googletag.pubads().refresh();
60+
});
61+
});
62+
}
63+
64+
setTimeout(function() {
65+
sendAdserverRequest();
66+
}, PREBID_TIMEOUT);
67+
68+
</script>
69+
70+
<script>
71+
(function () {
72+
var gads = document.createElement('script');
73+
gads.async = true;
74+
gads.type = 'text/javascript';
75+
var useSSL = 'https:' == document.location.protocol;
76+
gads.src = (useSSL ? 'https:' : 'http:') +
77+
'//www.googletagservices.com/tag/js/gpt.js';
78+
var node = document.getElementsByTagName('script')[0];
79+
node.parentNode.insertBefore(gads, node);
80+
})();
81+
</script>
82+
83+
<script>
84+
googletag.cmd.push(function () {
85+
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
86+
87+
googletag.pubads().enableSingleRequest();
88+
googletag.enableServices();
89+
});
90+
</script>
91+
</head>
92+
93+
<body>
94+
<h2>Prebid.js Test</h2>
95+
<h5>Div-1</h5>
96+
<div id='div-gpt-ad-1460505748561-0'>
97+
<script type='text/javascript'>
98+
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
99+
</script>
100+
</div>
101+
</body>
102+
</html>

modules/33acrossBidAdapter.js

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { userSync } from 'src/userSync'
12
const { registerBidder } = require('../src/adapters/bidderFactory');
2-
const utils = require('../src/utils');
3+
const { config } = require('../src/config');
34

45
const BIDDER_CODE = '33across';
56
const END_POINT = 'https://ssc.33across.com/api/v1/hb';
@@ -38,9 +39,7 @@ function _createServerRequest(bidRequest) {
3839
}
3940
}
4041

41-
// Allowing site to be a test configuration object or just the id (former required for testing,
42-
// latter when used by publishers)
43-
ttxRequest.site = params.site || { id: params.siteId };
42+
ttxRequest.site = { id: params.siteId };
4443

4544
// Go ahead send the bidId in request to 33exchange so it's kept track of in the bid response and
4645
// therefore in ad targetting process
@@ -51,28 +50,18 @@ function _createServerRequest(bidRequest) {
5150
withCredentials: false
5251
};
5352

54-
if (bidRequest.params.customHeaders) {
55-
options.customHeaders = bidRequest.params.customHeaders;
56-
}
53+
// Allow the ability to configure the HB endpoint for testing purposes.
54+
const ttxSettings = config.getConfig('ttxSettings');
55+
const url = (ttxSettings && ttxSettings.url) || END_POINT;
5756

5857
return {
5958
'method': 'POST',
60-
'url': bidRequest.params.url || END_POINT,
59+
'url': url,
6160
'data': JSON.stringify(ttxRequest),
6261
'options': options
6362
}
6463
}
6564

66-
// Sync object will always be of type iframe for ttx
67-
function _createSync(bid) {
68-
const syncUrl = bid.params.syncUrl || SYNC_ENDPOINT;
69-
70-
return {
71-
type: 'iframe',
72-
url: `${syncUrl}&id=${bid.params.siteId || bid.params.site.id}`
73-
}
74-
}
75-
7665
function _getFormatSize(sizeArr) {
7766
return {
7867
w: sizeArr[0],
@@ -81,6 +70,24 @@ function _getFormatSize(sizeArr) {
8170
}
8271
}
8372

73+
// Register one sync per bid since each ad unit may potenitally be linked to a uniqe guid
74+
// Sync type will always be 'iframe' for 33Across
75+
function _registerUserSyncs(requestData) {
76+
let ttxRequest;
77+
try {
78+
ttxRequest = JSON.parse(requestData);
79+
} catch (err) {
80+
// No point in trying to register sync since the requisite data cannot be parsed.
81+
return;
82+
}
83+
const ttxSettings = config.getConfig('ttxSettings');
84+
85+
let syncUrl = (ttxSettings && ttxSettings.syncUrl) || SYNC_ENDPOINT;
86+
87+
syncUrl = `${syncUrl}&id=${ttxRequest.site.id}`;
88+
userSync.registerSync('iframe', BIDDER_CODE, syncUrl);
89+
}
90+
8491
function isBidRequestValid(bid) {
8592
if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
8693
return false;
@@ -104,7 +111,12 @@ function buildRequests(bidRequests) {
104111
}
105112

106113
// NOTE: At this point, the response from 33exchange will only ever contain one bid i.e. the highest bid
107-
function interpretResponse(serverResponse) {
114+
function interpretResponse(serverResponse, bidRequest) {
115+
// Register user sync first
116+
if (bidRequest && bidRequest.data) {
117+
_registerUserSyncs(bidRequest.data);
118+
}
119+
108120
const bidResponses = [];
109121

110122
// If there are bids, look at the first bid of the first seatbid (see NOTE above for assumption about ttx)
@@ -115,24 +127,11 @@ function interpretResponse(serverResponse) {
115127
return bidResponses;
116128
}
117129

118-
// Register one sync per bid since each ad unit may potenitally be linked to a uniqe guid
119-
function getUserSyncs(syncOptions) {
120-
let syncs = [];
121-
const ttxBidRequests = utils.getBidderRequestAllAdUnits(BIDDER_CODE).bids;
122-
123-
if (syncOptions.iframeEnabled) {
124-
syncs = ttxBidRequests.map(_createSync);
125-
}
126-
127-
return syncs;
128-
}
129-
130130
const spec = {
131131
code: BIDDER_CODE,
132132
isBidRequestValid,
133133
buildRequests,
134-
interpretResponse,
135-
getUserSyncs
134+
interpretResponse
136135
}
137136

138137
registerBidder(spec);

0 commit comments

Comments
 (0)