Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase #1

Merged
merged 25 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b0c20ee
AdTrue Bid Adapter: getUserSyncs logic update (#6338)
haibau Mar 24, 2021
d2a0360
IX Bid Adapter: add priceFloors support and an integration example (#…
punkiller Mar 24, 2021
f3fe966
PBS adapter: remove condition on gdpr consentstring which isnt requir…
patmmccann Mar 24, 2021
9faeb68
if the stored value was an object, then it could end up with a space …
smenzer Mar 24, 2021
fa5c978
Kargo Bid Adapter: add gdpr support (#6447)
BernhardValenti Mar 24, 2021
1dc7c05
Bid Glass Adapter: Merge externally set targeting params (#6426)
dliebner Mar 24, 2021
f03e95a
Optimon Analytics Adapter: add new analytics adapter (#6333)
pixelgroup-israel Mar 24, 2021
95c5625
4.32.0 release
mkendall07 Mar 24, 2021
48cd16a
4.33.0-pre
mkendall07 Mar 24, 2021
94faa28
UID 2.0 Userid submodule (#6443)
SKOCHERI Mar 25, 2021
78b3a8b
H12media Bid Adapter: added new optional params, fixes, and various i…
h12media Mar 25, 2021
76c86e8
AdYouLike Bid Adapter: add video capabilities (#6398)
guiann Mar 25, 2021
b96f380
remove deprecated creative rendering example
ChrisHuie Mar 25, 2021
42182d6
Update Recommendation to install with 'npm ci' (#5697)
GLStephen Mar 25, 2021
5162ad8
Openx Bid Adapter: add floor support for Video (#6460)
kenan-gillet Mar 25, 2021
273e48b
Update to rubicon analytics adapter to pass along pbsBidId if present…
mmoschovas Mar 25, 2021
f3e0d4c
differentiate the IDs provided by ID5 when the user is opted out vs t…
smenzer Mar 25, 2021
ee468f7
AdagioBidAdapter: add capability to pass ext-data from localStorage i…
osazos Mar 26, 2021
9334c9b
Seedtag Bid Adapter: add connection type to bid request (#6457)
ybootin Mar 26, 2021
aa2463e
AdDefend Bid Adapter: new bid adapter (#6450)
addefend Mar 26, 2021
11b2dd2
GumGum Bid Adapter: adds meta field to bidresponse (#6478)
susyt Mar 27, 2021
7d76822
example integration file renamed to hello_world (#6475)
ChrisHuie Mar 29, 2021
d2e5956
Incorrect atypes on various eids (#6477)
patmmccann Mar 29, 2021
05869ed
added support for roundel alias (#6473)
lksharma Mar 29, 2021
971b515
Doceree Bid Adapter: new bid adapter (#6437)
sourbh-doceree Mar 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ prebid.requestBids({

$ git clone https://github.com/prebid/Prebid.js.git
$ cd Prebid.js
$ npm install
$ npm ci

*Note:* You need to have `NodeJS` 12.16.1 or greater installed.

*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To comply with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in its setup.
*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To comply with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm ci`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in its setup.

If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. You can check if this is installed by running `gulp -v` and seeing the version that's listed in the `CLI` field of the output. If you have the `gulp` package installed globally, it's likely the same version that you'll see in the `Local` field. If you already have `gulp-cli` installed, it should be a lower major version (it's at version `2.0.1` at the time of the transition).

Expand Down Expand Up @@ -265,7 +265,7 @@ directory you will have sourcemaps available in your browser's developer tools.

To run the example file, go to:

+ `http://localhost:9999/integrationExamples/gpt/pbjs_example_gpt.html`
+ `http://localhost:9999/integrationExamples/gpt/hello_world.html`

As you make code changes, the bundles will be rebuilt and the page reloaded automatically.

Expand Down
112 changes: 112 additions & 0 deletions integrationExamples/gpt/adUnitFloors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!--
This page calls a single bidder for a single ad slot.
It is a specialized example for adding floors to bids using the priceFloors Module
It also makes a good test page for new adapter PR submissions. Simply set your server's Bid Params object in the
bids array inside the adUnits, and it will use your adapter to load an ad.
NOTE that many ad servers won't send back an ad if the URL is localhost... so you might need to
set an alias in your /etc/hosts file so that you can load this page from a different domain.
-->

<html>

<head>
<script async src="../../build/dist/prebid.js"></script>
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;
var adUnits = [{
code: 'div-gpt-ad-51545-0',
sizes: [[300, 250], [600, 500]],
mediaTypes: {
banner: {
sizes: [[300, 250], [600, 500]]
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'ix',
params: {
siteId: '300',
size: [300, 250]
}
}]
}];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</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({
floors: {
enforcement: {
floorDeals: false, //default to false
bidAdjustment: true
},
data: { // default if endpoint doesn't return in time
currency: 'USD',
skipRate: 5,
modelVersion: 'BlackBerryZap',
schema: {
fields: ['gptSlot', 'mediaType', 'size']
},
values: {
'*|banner|600x500': 6.5,
'*|banner|300x250': 3.25,
'*|video': 3.5
}
}
}
});
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
});

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();
}, FAILSAFE_TIMEOUT);

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-51545-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-51545-0'>
<script type='text/javascript'>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-51545-0'); });
</script>
</div>
</body>

</html>

7 changes: 1 addition & 6 deletions integrationExamples/gpt/creative_rendering.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<!-- #1 deprecated method - use preferred method below instead-->
<script>
try{ window.top.$$PREBID_GLOBAL$$.renderAd(document, '%%PATTERN:hb_adid%%'); } catch(e) {/*ignore*/}
</script>

<!-- #2 preferred method for showing ad - handles cases when $$PREBID_GLOBAL$$ is not in the top window -->
<!-- preferred method for showing ad - handles cases when $$PREBID_GLOBAL$$ is not in the top window -->
<script>
var w = window;
for (i = 0; i < 10; i++) {
Expand Down
3 changes: 3 additions & 0 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@
{
name: "criteo"
},
{
name: "uid2"
}
],
syncDelay: 5000,
auctionDelay: 1000
Expand Down
68 changes: 65 additions & 3 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { OUTSTREAM } from '../src/video.js';

export const BIDDER_CODE = 'adagio';
export const LOG_PREFIX = 'Adagio:';
export const VERSION = '2.7.0';
export const VERSION = '2.8.0';
export const FEATURES_VERSION = '1';
export const ENDPOINT = 'https://mp.4dex.io/prebid';
export const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
Expand All @@ -23,7 +23,7 @@ export const ADAGIO_LOCALSTORAGE_KEY = 'adagioScript';
export const GVLID = 617;
export const storage = getStorageManager(GVLID, 'adagio');
export const RENDERER_URL = 'https://script.4dex.io/outstream-player.js';

export const MAX_SESS_DURATION = 30 * 60 * 1000;
export const ADAGIO_PUBKEY = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9el0+OEn6fvEh1RdVHQu4cnT0
jFSzIbGJJyg3cKqvtE6A0iaz9PkIdJIvSSSNrmJv+lRGKPEyRA/VnzJIieL39Ngl
Expand Down Expand Up @@ -62,6 +62,8 @@ export const ORTB_VIDEO_PARAMS = {

let currentWindow;

const EXT_DATA = {}

export function adagioScriptFromLocalStorageCb(ls) {
try {
if (!ls) {
Expand Down Expand Up @@ -108,6 +110,9 @@ export function getAdagioScript() {
// It's an antipattern regarding the TCF2 enforcement logic
// but it's the only way to respect the user choice update.
window.localStorage.removeItem(ADAGIO_LOCALSTORAGE_KEY);
// Extra data from external script.
// This key is removed only if localStorage is not accessible.
window.localStorage.removeItem('adagio');
}
});
}
Expand All @@ -131,6 +136,37 @@ function isSafeFrameWindow() {
return !!(ws.$sf && ws.$sf.ext);
}

// Get localStorage "adagio" data to be passed to the request
export function prepareExchange(storageValue) {
const adagioStorage = JSON.parse(storageValue, function(name, value) {
if (!name.startsWith('_') || name === '') {
return value;
}
});
let random = utils.deepAccess(adagioStorage, 'session.rnd');
let newSession = false;

if (internal.isNewSession(adagioStorage)) {
newSession = true;
random = Math.random();
}

const data = {
session: {
new: newSession,
rnd: random
}
}

utils.mergeDeep(EXT_DATA, adagioStorage, data);

internal.enqueue({
action: 'session',
ts: Date.now(),
data: EXT_DATA
});
}

function initAdagio() {
if (canAccessTopWindow()) {
currentWindow = (canAccessTopWindow()) ? utils.getWindowTop() : utils.getWindowSelf();
Expand All @@ -146,6 +182,14 @@ function initAdagio() {
w.ADAGIO.versions.adagioBidderAdapter = VERSION;
w.ADAGIO.isSafeFrameWindow = isSafeFrameWindow();

storage.getDataFromLocalStorage('adagio', (storageData) => {
try {
internal.prepareExchange(storageData);
} catch (e) {
utils.logError(LOG_PREFIX, e);
}
});

getAdagioScript();
}

Expand Down Expand Up @@ -561,6 +605,21 @@ function isRendererPreferredFromPublisher(bidRequest) {
);
}

/**
*
* @param {object} adagioStorage
* @returns {boolean}
*/
function isNewSession(adagioStorage) {
const now = Date.now();
const { lastActivityTime, vwSmplg } = utils.deepAccess(adagioStorage, 'session', {});
return (
!utils.isNumber(lastActivityTime) ||
!utils.isNumber(vwSmplg) ||
(now - lastActivityTime) > MAX_SESS_DURATION
)
}

export const internal = {
enqueue,
getOrAddAdagioAdUnit,
Expand All @@ -577,7 +636,9 @@ export const internal = {
getCurrentWindow,
supportIObs,
canAccessTopWindow,
isRendererPreferredFromPublisher
isRendererPreferredFromPublisher,
isNewSession,
prepareExchange
};

function _getGdprConsent(bidderRequest) {
Expand Down Expand Up @@ -918,6 +979,7 @@ export const spec = {
site: site,
pageviewId: pageviewId,
adUnits: groupedAdUnits[organizationId],
data: EXT_DATA,
regs: {
gdpr: gdprConsent,
coppa: coppa,
Expand Down
79 changes: 79 additions & 0 deletions modules/addefendBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'addefend';

export const spec = {
code: BIDDER_CODE,
hostname: 'https://addefend-platform.com',

getHostname() {
return this.hostname;
},
isBidRequestValid: function(bid) {
return (bid.sizes !== undefined && bid.bidId !== undefined && bid.params !== undefined &&
(bid.params.pageId !== undefined && (typeof bid.params.pageId === 'string')) &&
(bid.params.placementId !== undefined && (typeof bid.params.placementId === 'string')));
},
buildRequests: function(validBidRequests, bidderRequest) {
let bid = {
v: $$PREBID_GLOBAL$$.version,
auctionId: false,
pageId: false,
gdpr_consent: bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString ? bidderRequest.gdprConsent.consentString : '',
referer: bidderRequest.refererInfo.referer,
bids: [],
};

for (var i = 0; i < validBidRequests.length; i++) {
let vb = validBidRequests[i];
let o = vb.params;
bid.auctionId = vb.auctionId;
o.bidId = vb.bidId;
o.transactionId = vb.transactionId;
o.sizes = [];
if (o.trafficTypes) {
bid.trafficTypes = o.trafficTypes;
}
delete o.trafficTypes;

bid.pageId = o.pageId;
delete o.pageId;

if (vb.sizes && Array.isArray(vb.sizes)) {
for (var j = 0; j < vb.sizes.length; j++) {
let s = vb.sizes[j];
if (Array.isArray(s) && s.length == 2) {
o.sizes.push(s[0] + 'x' + s[1]);
}
}
}
bid.bids.push(o);
}
return [{
method: 'POST',
url: this.getHostname() + '/bid',
options: { withCredentials: true },
data: bid
}];
},
interpretResponse: function(serverResponse, request) {
const requiredKeys = ['requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId', 'netRevenue', 'currency', 'advertiserDomains'];
const validBidResponses = [];
serverResponse = serverResponse.body;
if (serverResponse && (serverResponse.length > 0)) {
serverResponse.forEach((bid) => {
const bidResponse = {};
for (const requiredKey of requiredKeys) {
if (!bid.hasOwnProperty(requiredKey)) {
return [];
}
bidResponse[requiredKey] = bid[requiredKey];
}
validBidResponses.push(bidResponse);
});
}
return validBidResponses;
}
}

registerBidder(spec);
Loading