Skip to content

Commit 059a38b

Browse files
author
AlessandroDG
authored
Rvr 2005 rvr analytics adapter (#4)
* Submitting EMX Digital Adapter (prebid#3173) * Submitting EMX Digital Prebid Adapter Submitting EMX Digital Prebid Adapter code * fixing lint errors. updating our md * updating to const/let variables. adding test spec. * fixed linting on test spec js * TheMediaGrid Bid Adapter (prebid#3204) * Added Grid Bid Adapter * remove priceType from TheMediaGrid Bid Adapter * Adding user sync method for IFRAME and Pixel (prebid#3232) * Submitting EMX Digital Prebid Adapter Submitting EMX Digital Prebid Adapter code * fixing lint errors. updating our md * updating to const/let variables. adding test spec. * fixed linting on test spec js * adding emx usersync methods * updates (prebid#3162) * Only set native targeting if value exists. (prebid#3225) * add nolint command line option, similar to notest (prebid#3234) * add inskin iab vendor id: enables consent via string (prebid#3235) * Added user sync support for undertone bid adapter (prebid#3172) * Added user sync support for undertone bid adapter (new pull request) * Added user sync support for undertone bid adapter * fix indentation * Changed utils.getWindowTop() with the newer prebid utilities * Updating Auction Init Pick for timestamp + Test update (prebid#3223) * Updating Auction Init Pick for timestamp + Test update * Updating Auction Init to include once again + Rubicon Analytics update accordingly * Removing from auction init events in favor of old * Add code, test, and doc for Adikteev adapter (prebid#3229) * Add code, test, and doc for Adikteev adapter * Reflect comments on other PR http://prebid.org/dev-docs/bidder-adaptor.html#referrers prebid#3230 (comment) * 'currency' isn't a bidder-specific param Update PR following this remark on another one: prebid#3228 (comment) * Add integration example, fix bid requestId * Quantcast adapter onTimeout (prebid#3239) * onTimeout WIP * test for onTimeout * some renaming * cleanup * cleanup * trying to fix the test * using ajax instead of fetch * Test cleanup (prebid#3238) * stub pixel call in justpremium tests * properly stub geolocation services to prevent prompts * stub img creation as well to prevent call in justpremium * Appnexus adapter: Added dealPriority and dealCode to bidResponse (prebid#3201) * Added dealPriority and dealCode to appnexus adapter * update failed test * added namespace and did deep merge * keep all properties together * use unit id being sent instead of hard coded auid (prebid#3236) * use unit id being sent instead of hard coded auid * make multiple requests * removes commented out code. adds aus param back * Prebid 1.30.0 Release * increment pre version * fix deal targeting for cpm 0 (prebid#3233) * YIELDONE adapter - support Video (prebid#3227) * added UserSync * added UserSync Unit Test * support for multi sizes * register the adapter as supporting video * supporting video * change requestId acquisition method * fix the parameter name of dealID * update test parameters * support instream video * add test for bidRequest * add test for interpretResponse * add test params * add note to documentaion * clarifying the multi-format support message * rtbhouseBidAdapter changes (prebid#3241) * Add transactionId support * Change site getting method * Add bidfloor param * correct user agent value population (prebid#3248) * RVR-1124 Setup initial skeleton analytics adapter that can send something. Approved-by: Alessandro Di Giovanni <[email protected]> * Formatted auction/events data to fit needed schema. * RVR-1135 fetched device data. * Applied feedback. * Applied feedback. * Fetched core. * Added click handler for reporting banners click events. * Applied analyzer for reporting displayed impressions. * Applied feedback. * Merged in RVR-1214-invoke-handlers-on-rendering (pull request #7) RVR-1214 Invoke handlers on rendering * RVR-1214 Invoked handlers right after ad is displayed. * Applied feedback. Approved-by: Alessandro Di Giovanni <[email protected]> * Merged in RVR-1192-configuration-global-parameters (pull request #8) RVR-1192 Configuration/Global parameters Approved-by: Alessandro Di Giovanni <[email protected]> * Merged in RVR-1181-Prebid-js-unit-tests-setup (pull request #6) RVR-1181 Prebid.js Unit tests setup Approved-by: Alessandro Di Giovanni <[email protected]> * Merged in RVR-1247-additional-data-to-impression-records (pull request #9) RVR-1247 Additional data to impression records Approved-by: Alessandro Di Giovanni <[email protected]> * Merged in RVR-1249-add-requestedbids-to-auction (pull request #10) RVR-1249 Add requested bids to auction object request. Approved-by: Alessandro Di Giovanni <[email protected]> * Merged in RVR-1261-fix-tests (pull request prebid#11) RVR-1261 fix tests * RVR-1261 Secured adapter from no containers configuration. And changed fetching URL. * RVR-1261 Added event check for request and changed some names. * Applied feedback. Approved-by: Alessandro Di Giovanni <[email protected]> * RVR-1352 analytics adapter bugs Approved-by: Alessandro Di Giovanni <[email protected]> * Fixed bug with geolocation notification. * fixed missing bracket. * one more fix. * RVR-1357 Different optimisation responses & tracking into auction event * RVR-1852 - Add content type and hardcoded auth headers (cherry picked from commit 4def881) * RVR-1852 - Change tracker host * RVR-1852 - Override content type instead of adding header * RVR-1914 Consistent data types in events Also removes undefined and null properties in audience events * Merged in RVR-1883-Add-Basic-Access-Authentication (pull request prebid#17) RVR-1883 Add Basic Access Authentication * RVR-1914 - Rename functions * RVR-1914 - Set default total_duration to null in bid response * RVR-1883 - Use RIVR_CLIENT_AUTH_TOKEN global variable for Auth token * RVR-1883 - Restore stub after every test not just at the end * RVR-1883 - Remove commented code * Increase code coverage * Fix for IE 11.0.0 and Safari 8.0.8 - includes() Use core-js includes function for array * Restore pbjs_api_spec.js * Fix API calls for rivr analytics impressions and clicks * RVR-2005 - Change auction object model * RVR-2005 - Set rvr_usr_id cookie * RVR-2005 - Remove BID_REQUESTED and BID_RESPONSE handlers We have the same infos all collected in AUCTION_END * RVR-2005 - build Bidders Array From Auction End * RVR-2005 - build impressions Array From Auction End * RVR-2005 - set status of winning bid * RVR-2005 - cleanup * RVR-2005 - adapt enableAnalytics() test * RVR-2005 - adapt all tests * RVR-2005 - Add Rivr Analytics adapter md file * RVR-2005 - rewrite connectAllUnits * RVR-2005 - correct typo * RVR-2005 - use IE compatible find()
1 parent a9dfc04 commit 059a38b

Some content is hidden

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

43 files changed

+2766
-582
lines changed

gulpfile.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ function escapePostbidConfig() {
7676
};
7777
escapePostbidConfig.displayName = 'escape-postbid-config';
7878

79-
function lint() {
79+
function lint(done) {
80+
if (argv.nolint) {
81+
return done();
82+
}
8083
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'])
8184
.pipe(eslint())
8285
.pipe(eslint.format('stylish'))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<html>
2+
3+
<head>
4+
<link rel="icon" type="image/png" href="/favicon.png">
5+
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
6+
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
7+
<script>
8+
var sizes = [
9+
[300, 250],
10+
[250, 300],
11+
[300, 600]
12+
];
13+
var PREBID_TIMEOUT = 3000;
14+
var FAILSAFE_TIMEOUT = 3000;
15+
16+
var adUnits = [{
17+
code: '/19968336/header-bid-tag-1',
18+
mediaTypes: {
19+
banner: {
20+
sizes: sizes
21+
}
22+
},
23+
bids: [{
24+
bidder: 'adikteev',
25+
params: {
26+
placementId: 13144370,
27+
stagingEnvironment: true,
28+
bidFloorPrice: 0.1,
29+
}
30+
}]
31+
}];
32+
33+
// ======== DO NOT EDIT BELOW THIS LINE =========== //
34+
var googletag = googletag || {};
35+
googletag.cmd = googletag.cmd || [];
36+
googletag.cmd.push(function () {
37+
googletag.pubads().disableInitialLoad();
38+
});
39+
40+
var pbjs = pbjs || {};
41+
pbjs.que = pbjs.que || [];
42+
43+
pbjs.que.push(function () {
44+
pbjs.addAdUnits(adUnits);
45+
pbjs.requestBids({
46+
bidsBackHandler: initAdserver,
47+
timeout: PREBID_TIMEOUT
48+
});
49+
});
50+
51+
function initAdserver() {
52+
if (pbjs.initAdserverSet) return;
53+
pbjs.initAdserverSet = true;
54+
googletag.cmd.push(function () {
55+
pbjs.que.push(function () {
56+
pbjs.setTargetingForGPTAsync();
57+
googletag.pubads().refresh();
58+
});
59+
});
60+
}
61+
62+
63+
// in case PBJS doesn't load
64+
setTimeout(function () {
65+
console.log("prebid.js setTimeout");
66+
initAdserver();
67+
}, FAILSAFE_TIMEOUT);
68+
69+
googletag.cmd.push(function () {
70+
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
71+
.addService(googletag.pubads());
72+
googletag.pubads().enableSingleRequest();
73+
googletag.enableServices();
74+
});
75+
76+
</script>
77+
78+
</head>
79+
80+
<body>
81+
<h2>Basic Prebid.js Example</h2>
82+
<h5>Div-1</h5>
83+
<div id='div-1'>
84+
<script type='text/javascript'>
85+
googletag.cmd.push(function () {
86+
googletag.display('div-1');
87+
});
88+
89+
</script>
90+
</div>
91+
</body>
92+
93+
</html>

integrationExamples/gpt/pbjs_example_gpt.html

+9-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,15 @@
312312
width: '300',
313313
height: '250',
314314
}
315-
}
316-
315+
},
316+
{
317+
bidder: 'adikteev',
318+
params: {
319+
placementId: 12345,
320+
currency: 'EUR',
321+
bidFloorPrice: 0.1,
322+
}
323+
},
317324
]
318325
}, {
319326
code: 'div-gpt-ad-12345678-1',

modules/adikteevBidAdapter.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import {registerBidder} from 'src/adapters/bidderFactory';
2+
import {BANNER} from 'src/mediaTypes';
3+
import * as utils from '../src/utils';
4+
import {config} from 'src/config';
5+
6+
export const BIDDER_CODE = 'adikteev';
7+
export const ENDPOINT_URL = 'https://serve-adserver.adikteev.com/api/prebid/bid';
8+
export const ENDPOINT_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/bid';
9+
export const USER_SYNC_IFRAME_URL = 'https://serve-adserver.adikteev.com/api/prebid/sync-iframe';
10+
export const USER_SYNC_IFRAME_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/sync-iframe';
11+
export const USER_SYNC_IMAGE_URL = 'https://serve-adserver.adikteev.com/api/prebid/sync-image';
12+
export const USER_SYNC_IMAGE_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/sync-image';
13+
14+
export let stagingEnvironmentSwitch = false; // Don't use it. Allow us to make tests on staging
15+
16+
export function setstagingEnvironmentSwitch(value) {
17+
stagingEnvironmentSwitch = value;
18+
}
19+
20+
function validateSizes(sizes) {
21+
if (!utils.isArray(sizes) || typeof sizes[0] === 'undefined') {
22+
return false;
23+
}
24+
return sizes.every(size => utils.isArray(size) && size.length === 2);
25+
}
26+
27+
export const spec = {
28+
code: BIDDER_CODE,
29+
supportedMediaTypes: [BANNER],
30+
31+
isBidRequestValid: (bid) => {
32+
setstagingEnvironmentSwitch(stagingEnvironmentSwitch || !!bid.params.stagingEnvironment);
33+
return !!(
34+
bid &&
35+
bid.params &&
36+
bid.params.bidFloorPrice &&
37+
bid.params.placementId &&
38+
bid.bidder === BIDDER_CODE &&
39+
validateSizes(bid.mediaTypes.banner.sizes)
40+
);
41+
},
42+
43+
buildRequests: (validBidRequests, bidderRequest) => {
44+
const payload = {
45+
validBidRequests,
46+
bidderRequest,
47+
refererInfo: bidderRequest.refererInfo,
48+
currency: config.getConfig('currency'),
49+
userAgent: navigator.userAgent,
50+
screen: {
51+
width: window.screen.width,
52+
height: window.screen.height
53+
},
54+
language: navigator.language,
55+
cookies: document.cookie.split(';'),
56+
prebidUpdateVersion: '1.29.0',
57+
};
58+
return {
59+
method: 'POST',
60+
url: stagingEnvironmentSwitch ? ENDPOINT_URL_STAGING : ENDPOINT_URL,
61+
data: JSON.stringify(payload),
62+
};
63+
},
64+
65+
interpretResponse: (serverResponse, bidRequests) => {
66+
const returnedBids = [];
67+
const validBidRequests = JSON.parse(bidRequests.data).validBidRequests;
68+
serverResponse.body.forEach((value, index) => {
69+
const overrides = {
70+
requestId: validBidRequests[index].bidId,
71+
};
72+
returnedBids.push(Object.assign({}, value, overrides));
73+
});
74+
return returnedBids;
75+
},
76+
77+
getUserSyncs: (syncOptions, serverResponses) => {
78+
const syncs = [];
79+
if (syncOptions.iframeEnabled) {
80+
syncs.push({
81+
type: 'iframe',
82+
url: stagingEnvironmentSwitch ? USER_SYNC_IFRAME_URL_STAGING : USER_SYNC_IFRAME_URL,
83+
});
84+
}
85+
if (syncOptions.pixelEnabled && serverResponses.length > 0) {
86+
syncs.push({
87+
type: 'image',
88+
url: stagingEnvironmentSwitch ? USER_SYNC_IMAGE_URL_STAGING : USER_SYNC_IMAGE_URL,
89+
});
90+
}
91+
return syncs;
92+
},
93+
};
94+
registerBidder(spec);

modules/adikteevBidAdapter.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Overview
2+
3+
```
4+
Module Name: Adikteev Bidder Adapter
5+
Module Type: Bidder Adapter
6+
Maintainer: [email protected]
7+
```
8+
9+
# Description
10+
11+
Module that connects to Adikteev's demand sources
12+
13+
# Test Parameters
14+
15+
``` javascript
16+
var adUnits = [
17+
{
18+
code: 'test-div',
19+
mediaTypes: {
20+
banner: {
21+
sizes: [[750, 200]], // a display size
22+
}
23+
},
24+
bids: [
25+
{
26+
bidder: 'adikteev',
27+
params: {
28+
placementId: 12345,
29+
bidFloorPrice: 0.1,
30+
}
31+
}
32+
]
33+
}
34+
];
35+
```

modules/appnexusBidAdapter.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ function newBid(serverBid, rtbBid, bidderRequest) {
233233
netRevenue: true,
234234
ttl: 300,
235235
appnexus: {
236-
buyerMemberId: rtbBid.buyer_member_id
236+
buyerMemberId: rtbBid.buyer_member_id,
237+
dealPriority: rtbBid.deal_priority,
238+
dealCode: rtbBid.deal_code
237239
}
238240
};
239241

modules/emx_digitalBidAdapter.js

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import * as utils from 'src/utils';
2+
import {
3+
registerBidder
4+
} from 'src/adapters/bidderFactory';
5+
import {
6+
BANNER
7+
} from 'src/mediaTypes';
8+
import {
9+
config
10+
} from 'src/config';
11+
12+
const BIDDER_CODE = 'emx_digital';
13+
const ENDPOINT = 'hb.emxdgt.com';
14+
export const spec = {
15+
code: BIDDER_CODE,
16+
supportedMediaTypes: [BANNER],
17+
isBidRequestValid: function (bid) {
18+
return !!(bid.params.tagid);
19+
},
20+
buildRequests: function (validBidRequests, bidRequests) {
21+
const {host, href, protocol} = utils.getTopWindowLocation();
22+
let emxData = {};
23+
let emxImps = [];
24+
const auctionId = bidRequests.auctionId;
25+
const timeout = config.getConfig('bidderTimeout');
26+
const timestamp = Date.now();
27+
const url = location.protocol + '//' + ENDPOINT + ('?t=' + timeout + '&ts=' + timestamp);
28+
29+
utils._each(validBidRequests, function (bid) {
30+
let tagId = String(utils.getBidIdParameter('tagid', bid.params));
31+
let bidFloor = utils.getBidIdParameter('bidfloor', bid.params) || 0;
32+
let emxBid = {
33+
id: bid.bidId,
34+
tid: bid.transactionId,
35+
tagid: tagId,
36+
secure: protocol === 'https:' ? 1 : 0,
37+
banner: {
38+
format: bid.sizes.map(function (size) {
39+
return {
40+
w: size[0],
41+
h: size[1]
42+
};
43+
}),
44+
w: bid.sizes[0][0],
45+
h: bid.sizes[0][1]
46+
}
47+
}
48+
if (bidFloor > 0) {
49+
emxBid.bidfloor = bidFloor
50+
}
51+
emxImps.push(emxBid);
52+
});
53+
emxData = {
54+
id: auctionId,
55+
imp: emxImps,
56+
site: {
57+
domain: host,
58+
page: href
59+
}
60+
};
61+
if (bidRequests.gdprConsent) {
62+
emxData.regs = {
63+
ext: {
64+
gdpr: bidRequests.gdprConsent.gdprApplies === true ? 1 : 0
65+
}
66+
};
67+
}
68+
if (bidRequests.gdprConsent && bidRequests.gdprConsent.gdprApplies) {
69+
emxData.user = {
70+
ext: {
71+
consent: bidRequests.gdprConsent.consentString
72+
}
73+
};
74+
}
75+
return {
76+
method: 'POST',
77+
url: url,
78+
data: JSON.stringify(emxData),
79+
options: {
80+
withCredentials: true
81+
}
82+
};
83+
},
84+
interpretResponse: function (serverResponse) {
85+
let emxBidResponses = [];
86+
let response = serverResponse.body || {};
87+
if (response.seatbid && response.seatbid.length > 0 && response.seatbid[0].bid) {
88+
response.seatbid.forEach(function (emxBid) {
89+
emxBid = emxBid.bid[0];
90+
emxBidResponses.push({
91+
requestId: emxBid.id,
92+
cpm: emxBid.price,
93+
width: emxBid.w,
94+
height: emxBid.h,
95+
creativeId: emxBid.crid || emxBid.id,
96+
dealId: emxBid.dealid || null,
97+
currency: 'USD',
98+
netRevenue: true,
99+
mediaType: BANNER,
100+
ad: decodeURIComponent(emxBid.adm),
101+
ttl: emxBid.ttl
102+
});
103+
});
104+
}
105+
return emxBidResponses;
106+
},
107+
getUserSyncs: function (syncOptions) {
108+
const syncs = [];
109+
if (syncOptions.iframeEnabled) {
110+
syncs.push({
111+
type: 'iframe',
112+
url: '//biddr.brealtime.com/check.html'
113+
});
114+
}
115+
if (syncOptions.pixelEnabled) {
116+
syncs.push({
117+
type: 'image',
118+
url: '//edba.brealtime.com/'
119+
});
120+
}
121+
return syncs;
122+
}
123+
};
124+
registerBidder(spec);

0 commit comments

Comments
 (0)