forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/prebid/Prebid.js into Nob…
…idVersion1.2.0 * 'master' of https://github.com/prebid/Prebid.js: (22 commits) fix lint errors in unit test file (prebid#4702) Add Revcontent Adapter (prebid#4654) Changed data structure in Platform One Analytic Adapter (prebid#4647) increment pre version Prebid 3.2.0 Release Add static API option to the consentManagementUsp module. (prebid#4685) replace all xhr stubs with global xhr stub to prevent all requests (prebid#4687) Add CCPA us_privacy support to spotxBidAdapter (prebid#4689) ucfunnel adapter support CCPA and remove utils.js in adapter (prebid#4541) freewheelSSPBidAdapter (prebid#4645) Add CCPA support to Beachfront adapter (prebid#4673) add seedingAlliance Adapter (prebid#4614) Changed analytics data structure in YuktaMedia Analytic Adapter (prebid#4659) Add eplanning adapter for prebid 3.0 compliant and CCPA and GDPR support (prebid#4643) Bidder schain support (prebid#4551) Added CCPA support and GDPR compliance to Cedato adapter (prebid#4683) pass us privacy consent string to request (prebid#4581) Prebid 3 Admixer (prebid#4615) Pass uspConsent in bidRequest (prebid#4675) Advertly: New Bidder Adapter Submission (prebid#4496) ...
- Loading branch information
Showing
93 changed files
with
6,554 additions
and
737 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
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
Empty file.
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,109 @@ | ||
<html> | ||
|
||
<head> | ||
<link rel="icon" type="image/png" href="/favicon.png"> | ||
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script> | ||
<script async src="../../build/dev/prebid.js"></script> | ||
<script> | ||
/* | ||
Supported sizes: | ||
---------------- | ||
300x250 - Medium rectangle | ||
728x90 - Leaderboard | ||
300x600 - Half page or large skyscraper | ||
*/ | ||
var size = {width: 300, height: 250}; | ||
|
||
var PREBID_TIMEOUT = 10000; | ||
var FAILSAFE_TIMEOUT = 30000; | ||
|
||
var adUnits = [{ | ||
code: '/19968336/header-bid-tag-1', | ||
mediaTypes: { | ||
native: { | ||
image: { | ||
required: false | ||
}, | ||
title: { | ||
required: false, | ||
len: 140 | ||
}, | ||
clickUrl: { | ||
required: false | ||
}, | ||
sponsoredBy: { | ||
id: 5, | ||
name: 'data', | ||
type: 1 | ||
} | ||
} | ||
}, | ||
bids: [{ | ||
bidder: 'revcontent', | ||
params: { | ||
size: size, | ||
apiKey: '8a33fa9cf220ae685dcc3544f847cdda858d3b1c', | ||
userId: 673, | ||
domain: 'test.com', | ||
endpoint: 'trends-s0.revcontent.com' | ||
} | ||
}] | ||
}]; | ||
|
||
// ======== DO NOT EDIT BELOW THIS LINE =========== // | ||
var googletag = googletag || {}; | ||
googletag.cmd = googletag.cmd || []; | ||
googletag.cmd.push(function() { | ||
googletag.pubads().disableInitialLoad(); | ||
}); | ||
|
||
var pbjs = pbjs || {}; | ||
pbjs.que = pbjs.que || []; | ||
|
||
pbjs.que.push(function() { | ||
pbjs.addAdUnits(adUnits); | ||
pbjs.requestBids({ | ||
bidsBackHandler: initAdserver, | ||
timeout: PREBID_TIMEOUT | ||
}); | ||
}); | ||
|
||
function initAdserver() { | ||
if (pbjs.initAdserverSet) return; | ||
pbjs.initAdserverSet = true; | ||
googletag.cmd.push(function() { | ||
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync(); | ||
googletag.pubads().refresh(); | ||
}); | ||
} | ||
|
||
// in case PBJS doesn't load | ||
setTimeout(function() { | ||
initAdserver(); | ||
}, FAILSAFE_TIMEOUT); | ||
|
||
googletag.cmd.push(function() { | ||
googletag.defineSlot('/19968336/header-bid-tag-1', [[size.width, size.height]], 'div-1') | ||
.addService(googletag.pubads()); | ||
googletag.pubads().enableSingleRequest(); | ||
googletag.enableServices(); | ||
}); | ||
|
||
</script> | ||
|
||
</head> | ||
|
||
<body> | ||
<h2>Basic Prebid.js Example</h2> | ||
<h5>Div-1</h5> | ||
<div id='div-1'> | ||
<script type='text/javascript'> | ||
googletag.cmd.push(function() { | ||
googletag.display('div-1'); | ||
}); | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as utils from '../src/utils'; | ||
import {registerBidder} from '../src/adapters/bidderFactory'; | ||
|
||
const BIDDER_CODE = 'admixer'; | ||
const ALIASES = ['go2net']; | ||
const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.0.aspx'; | ||
export const spec = { | ||
code: BIDDER_CODE, | ||
aliases: ALIASES, | ||
supportedMediaTypes: ['banner', 'video'], | ||
/** | ||
* Determines whether or not the given bid request is valid. | ||
*/ | ||
isBidRequestValid: function (bid) { | ||
return !!bid.params.zone; | ||
}, | ||
/** | ||
* Make a server request from the list of BidRequests. | ||
*/ | ||
buildRequests: function (validRequest, bidderRequest) { | ||
const payload = { | ||
imps: [], | ||
referrer: encodeURIComponent(bidderRequest.refererInfo.referer), | ||
}; | ||
validRequest.forEach((bid) => { | ||
payload.imps.push(bid); | ||
}); | ||
const payloadString = JSON.stringify(payload); | ||
return { | ||
method: 'GET', | ||
url: ENDPOINT_URL, | ||
data: `data=${payloadString}`, | ||
}; | ||
}, | ||
/** | ||
* Unpack the response from the server into a list of bids. | ||
*/ | ||
interpretResponse: function (serverResponse, bidRequest) { | ||
const bidResponses = []; | ||
// loop through serverResponses { | ||
try { | ||
serverResponse = serverResponse.body; | ||
serverResponse.forEach((bidResponse) => { | ||
const bidResp = { | ||
requestId: bidResponse.bidId, | ||
cpm: bidResponse.cpm, | ||
width: bidResponse.width, | ||
height: bidResponse.height, | ||
ad: bidResponse.ad, | ||
ttl: bidResponse.ttl, | ||
creativeId: bidResponse.creativeId, | ||
netRevenue: bidResponse.netRevenue, | ||
currency: bidResponse.currency, | ||
vastUrl: bidResponse.vastUrl, | ||
}; | ||
bidResponses.push(bidResp); | ||
}); | ||
} catch (e) { | ||
utils.logError(e); | ||
} | ||
return bidResponses; | ||
} | ||
}; | ||
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
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,127 @@ | ||
import { registerBidder } from '../src/adapters/bidderFactory'; | ||
import { config } from '../src/config'; | ||
import * as utils from '../src/utils'; | ||
import {BANNER, VIDEO} from '../src/mediaTypes'; | ||
import { ajax } from '../src/ajax'; | ||
import {Renderer} from '../src/Renderer'; | ||
|
||
const SUPPORTED_AD_TYPES = [BANNER, VIDEO]; | ||
const BIDDER_CODE = 'advertly'; | ||
const DOMAIN = 'https://api.advertly.com/'; | ||
const RENDERER_URL = '//acdn.adnxs.com/video/outstream/ANOutstreamVideo.js'; | ||
|
||
function isBidRequestValid(bid) { | ||
return (typeof bid.params !== 'undefined' && parseInt(utils.getValue(bid.params, 'publisherId')) > 0); | ||
} | ||
|
||
function buildRequests(validBidRequests) { | ||
return { | ||
method: 'POST', | ||
url: DOMAIN + 'www/admin/plugins/Prebid/getAd.php', | ||
options: { | ||
withCredentials: false, | ||
crossOrigin: true | ||
}, | ||
data: validBidRequests, | ||
}; | ||
} | ||
|
||
function interpretResponse(serverResponse, request) { | ||
const response = serverResponse.body; | ||
const bidResponses = []; | ||
var bidRequestResponses = []; | ||
utils._each(response, function(bidAd) { | ||
let bnd = {}; | ||
Object.assign(bnd, bidAd); | ||
bnd.adResponse = { | ||
content: bidAd.vastXml, | ||
height: bidAd.height, | ||
width: bidAd.width | ||
}; | ||
bnd.ttl = config.getConfig('_bidderTimeout') | ||
bnd.renderer = bidAd.context === 'outstream' ? createRenderer(bidAd, RENDERER_URL) : undefined; | ||
bidResponses.push(bnd); | ||
}); | ||
|
||
bidRequestResponses.push({ | ||
function: 'saveResponses', | ||
request: request, | ||
response: bidResponses | ||
}); | ||
sendResponseToServer(bidRequestResponses); | ||
return bidResponses; | ||
} | ||
|
||
function outstreamRender(bidAd) { | ||
bidAd.renderer.push(() => { | ||
window.ANOutstreamVideo.renderAd({ | ||
sizes: [bidAd.width, bidAd.height], | ||
width: bidAd.width, | ||
height: bidAd.height, | ||
targetId: bidAd.adUnitCode, | ||
adResponse: bidAd.adResponse, | ||
rendererOptions: { | ||
showVolume: false, | ||
allowFullscreen: false | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function createRenderer(bidAd, url) { | ||
const renderer = Renderer.install({ | ||
id: bidAd.adUnitCode, | ||
url: url, | ||
loaded: false, | ||
config: {'player_height': bidAd.height, 'player_width': bidAd.width}, | ||
adUnitCode: bidAd.adUnitCode | ||
}); | ||
try { | ||
renderer.setRender(outstreamRender); | ||
} catch (err) { | ||
utils.logWarn('Prebid Error calling setRender on renderer', err); | ||
} | ||
return renderer; | ||
} | ||
|
||
function onBidWon(bid) { | ||
let wonBids = []; | ||
wonBids.push(bid); | ||
wonBids[0].function = 'onBidWon'; | ||
sendResponseToServer(wonBids); | ||
} | ||
|
||
function onTimeout(details) { | ||
details.unshift({ 'function': 'onTimeout' }); | ||
sendResponseToServer(details); | ||
} | ||
|
||
function sendResponseToServer(data) { | ||
ajax(DOMAIN + 'www/admin/plugins/Prebid/tracking/track.php', null, JSON.stringify(data), { | ||
withCredentials: false, | ||
method: 'POST', | ||
crossOrigin: true | ||
}); | ||
} | ||
|
||
function getUserSyncs(syncOptions) { | ||
if (syncOptions.iframeEnabled) { | ||
return [{ | ||
type: 'iframe', | ||
url: DOMAIN + 'www/admin/plugins/Prebid/userSync.php' | ||
}]; | ||
} | ||
} | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: SUPPORTED_AD_TYPES, | ||
isBidRequestValid, | ||
buildRequests, | ||
interpretResponse, | ||
getUserSyncs, | ||
onBidWon, | ||
onTimeout | ||
}; | ||
|
||
registerBidder(spec); |
Oops, something went wrong.