forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'PreBid.js/master'
* PreBid.js/master: (79 commits) increment prebid version Prebid 1.11.0 release replace find reference with imported version (prebid#2542) GDPR - add consent information to PBS cookie_sync request (prebid#2530) add support for safeframe workflow and new utils method to read adunit sizes (prebid#2523) Smart: GDPR support (prebid#2528) fix getPreparedBidForAuction to look for renderer on correct bid (prebid#2505) PubMatic Adapter: Bug fix to read all bids from seatBid array (prebid#2520) Create GXOne Bid Adapter and tests for it (prebid#2540) Lifestreet: gdpr and consent string parameters (prebid#2537) -GDPR support added in media net bidder (prebid#2538) change AppNexus endpoint to use ORTB (prebid#2532) fixed bug when latitute/longitue are not provided (prebid#2533) added gdpr support to userSync in rubicon adapter (prebid#2531) Show only summary and errors (prebid#2514) Aardvark v1.0 (prebid#2507) Add 1024x768 (size_id = 53) in sizeMap (prebid#2527) Add new Adapter brainyBidAdapter (prebid#2458) OpenX Adapter: GDPR Support (prebid#2504) add support for latLong in rubicon adapter (prebid#2508) ...
- Loading branch information
Showing
121 changed files
with
14,864 additions
and
10,874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
{ | ||
"presets": ["es2015"], | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"browsers": [ | ||
"chrome >= 61", | ||
"safari >=8", | ||
"edge >= 14", | ||
"ff >= 57", | ||
"ie >= 10", | ||
"ios >= 8" | ||
] | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-object-assign", | ||
"transform-es3-property-literals", | ||
"transform-es3-member-expression-literals" | ||
"transform-object-assign" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<html> | ||
<head> | ||
<script>window.__cmp = {config: {logging: 'debug'}}</script> | ||
<script src="//acdn.adnxs.com/cmp/cmp.complete.bundle.js" async></script> | ||
|
||
<script> | ||
var PREBID_TIMEOUT = 700; | ||
|
||
var adUnits = [{ | ||
code: 'div-gpt-ad-1460505748561-0', | ||
sizes: [[300, 250], [300,600]], | ||
|
||
// Replace this object to test a new Adapter! | ||
bids: [{ | ||
bidder: 'appnexusAst', | ||
params: { | ||
placementId: '10433394' | ||
} | ||
}] | ||
|
||
}]; | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
|
||
</script> | ||
|
||
<script type="text/javascript" src="../../build/dev/prebid.js" async></script> | ||
<script> | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function() { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
|
||
pbjs.que.push(function() { | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.setConfig({ | ||
consentManagement: { | ||
cmpApi: 'iab', | ||
timeout: 5000, | ||
allowAuctionWithoutConsent: true | ||
}, | ||
pubcid: { | ||
enable: false | ||
} | ||
}); | ||
pbjs.requestBids({ | ||
bidsBackHandler: sendAdserverRequest | ||
}); | ||
}); | ||
|
||
function sendAdserverRequest() { | ||
if (pbjs.adserverRequestSent) return; | ||
pbjs.adserverRequestSent = true; | ||
googletag.cmd.push(function() { | ||
pbjs.que.push(function() { | ||
pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
}); | ||
} | ||
|
||
// setTimeout(function() { | ||
// sendAdserverRequest(); | ||
// console.log('timeout in main pbjs fired'); | ||
// }, PREBID_TIMEOUT); | ||
|
||
</script> | ||
|
||
<script> | ||
(function () { | ||
var gads = document.createElement('script'); | ||
gads.async = true; | ||
gads.type = 'text/javascript'; | ||
var useSSL = 'https:' == document.location.protocol; | ||
gads.src = (useSSL ? 'https:' : 'http:') + | ||
'//www.googletagservices.com/tag/js/gpt.js'; | ||
var node = document.getElementsByTagName('script')[0]; | ||
node.parentNode.insertBefore(gads, node); | ||
})(); | ||
</script> | ||
|
||
<script> | ||
googletag.cmd.push(function () { | ||
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads()); | ||
|
||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h2>Prebid.js Test</h2> | ||
<h5>Div-1</h5> | ||
<div id='div-gpt-ad-1460505748561-0'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); }); | ||
</script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import * as utils from 'src/utils'; | ||
import {registerBidder} from 'src/adapters/bidderFactory'; | ||
|
||
const BIDDER_CODE = 'aardvark'; | ||
const DEFAULT_ENDPOINT = 'bidder.rtk.io'; | ||
const SYNC_ENDPOINT = 'sync.rtk.io'; | ||
const AARDVARK_TTL = 300; | ||
const AARDVARK_CURRENCY = 'USD'; | ||
|
||
let hasSynced = false; | ||
|
||
export function resetUserSync() { | ||
hasSynced = false; | ||
} | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
|
||
isBidRequestValid: function(bid) { | ||
return ((typeof bid.params.ai === 'string') && !!bid.params.ai.length && | ||
(typeof bid.params.sc === 'string') && !!bid.params.sc.length); | ||
}, | ||
|
||
buildRequests: function(validBidRequests, bidderRequest) { | ||
var auctionCodes = []; | ||
var requests = []; | ||
var requestsMap = {}; | ||
var referer = utils.getTopWindowUrl(); | ||
var pageCategories = []; | ||
|
||
if (window.top.rtkcategories && Array.isArray(window.top.rtkcategories)) { | ||
pageCategories = window.top.rtkcategories; | ||
} | ||
|
||
utils._each(validBidRequests, function(b) { | ||
var rMap = requestsMap[b.params.ai]; | ||
if (!rMap) { | ||
rMap = { | ||
shortCodes: [], | ||
payload: { | ||
version: 1, | ||
jsonp: false, | ||
rtkreferer: referer | ||
}, | ||
endpoint: DEFAULT_ENDPOINT | ||
}; | ||
|
||
if (pageCategories && pageCategories.length) { | ||
rMap.payload.categories = pageCategories.slice(0); | ||
} | ||
|
||
if (b.params.categories && b.params.categories.length) { | ||
rMap.payload.categories = rMap.payload.categories || [] | ||
utils._each(b.params.categories, function(cat) { | ||
rMap.payload.categories.push(cat); | ||
}); | ||
} | ||
|
||
if (bidderRequest && bidderRequest.gdprConsent) { | ||
rMap.payload.gdpr = false; | ||
if (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') { | ||
rMap.payload.gdpr = bidderRequest.gdprConsent.gdprApplies; | ||
} | ||
if (rMap.payload.gdpr) { | ||
rMap.payload.consent = bidderRequest.gdprConsent.consentString; | ||
} | ||
} | ||
|
||
requestsMap[b.params.ai] = rMap; | ||
auctionCodes.push(b.params.ai); | ||
} | ||
|
||
rMap.shortCodes.push(b.params.sc); | ||
rMap.payload[b.params.sc] = b.bidId; | ||
|
||
if ((typeof b.params.host === 'string') && b.params.host.length && | ||
(b.params.host !== rMap.endpoint)) { | ||
rMap.endpoint = b.params.host; | ||
} | ||
}); | ||
|
||
utils._each(auctionCodes, function(auctionId) { | ||
var req = requestsMap[auctionId]; | ||
requests.push({ | ||
method: 'GET', | ||
url: `//${req.endpoint}/${auctionId}/${req.shortCodes.join('_')}/aardvark`, | ||
data: req.payload, | ||
bidderRequest | ||
}); | ||
}); | ||
|
||
return requests; | ||
}, | ||
|
||
interpretResponse: function(serverResponse, bidRequest) { | ||
var bidResponses = []; | ||
|
||
if (!Array.isArray(serverResponse.body)) { | ||
serverResponse.body = [serverResponse.body]; | ||
} | ||
|
||
utils._each(serverResponse.body, function(rawBid) { | ||
var bidResponse = { | ||
requestId: rawBid.cid, | ||
cpm: rawBid.cpm || 0, | ||
width: rawBid.width || 0, | ||
height: rawBid.height || 0, | ||
currency: rawBid.currency ? rawBid.currency : AARDVARK_CURRENCY, | ||
netRevenue: rawBid.netRevenue ? rawBid.netRevenue : true, | ||
ttl: rawBid.ttl ? rawBid.ttl : AARDVARK_TTL, | ||
creativeId: rawBid.creativeId || 0 | ||
}; | ||
|
||
if (rawBid.hasOwnProperty('dealId')) { | ||
bidResponse.dealId = rawBid.dealId | ||
} | ||
|
||
switch (rawBid.media) { | ||
case 'banner': | ||
bidResponse.ad = rawBid.adm + utils.createTrackPixelHtml(decodeURIComponent(rawBid.nurl)); | ||
break; | ||
|
||
default: | ||
return utils.logError('bad Aardvark response (media)', rawBid); | ||
} | ||
|
||
bidResponses.push(bidResponse); | ||
}); | ||
|
||
return bidResponses; | ||
}, | ||
|
||
getUserSyncs: function(syncOptions, serverResponses, gdprConsent) { | ||
const syncs = []; | ||
var url = '//' + SYNC_ENDPOINT + '/cs'; | ||
var gdprApplies = false; | ||
if (gdprConsent && (typeof gdprConsent.gdprApplies === 'boolean')) { | ||
gdprApplies = gdprConsent.gdprApplies; | ||
} | ||
|
||
if (syncOptions.iframeEnabled) { | ||
if (!hasSynced) { | ||
hasSynced = true; | ||
if (gdprApplies) { | ||
url = url + '?g=1&c=' + encodeURIComponent(gdprConsent.consentString); | ||
} | ||
syncs.push({ | ||
type: 'iframe', | ||
url: url | ||
}); | ||
} | ||
} else { | ||
utils.logWarn('Aardvark: Please enable iframe based user sync.'); | ||
} | ||
return syncs; | ||
} | ||
}; | ||
|
||
registerBidder(spec); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Overview | ||
|
||
**Module Name**: Aardvark Bidder Adapter | ||
**Module Type**: Bidder Adapter | ||
**Maintainer**: chris@rtk.io | ||
|
||
# Description | ||
|
||
Module that connects to a RTK.io Ad Units to fetch bids. | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [{ | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], | ||
} | ||
}, | ||
code: 'div-gpt-ad-1460505748561-0', | ||
bids: [{ | ||
bidder: 'aardvark', | ||
params: { | ||
ai: '0000', | ||
sc: '1234' | ||
} | ||
}] | ||
}]; | ||
``` |
Oops, something went wrong.