prebid.js 6.4.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/x-domain/creative.html +53 -26
- package/modules/.submodules.json +2 -1
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +23 -11
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/adyoulikeBidAdapter.js +13 -9
- package/modules/appnexusBidAdapter.js +11 -0
- package/modules/bliinkBidAdapter.js +3 -2
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +10 -3
- package/modules/consentManagement.js +7 -1
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +26 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/docereeBidAdapter.js +10 -1
- package/modules/docereeBidAdapter.md +2 -0
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/gptPreAuction.js +55 -7
- package/modules/gumgumBidAdapter.js +56 -42
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +24 -2
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/ixBidAdapter.js +29 -12
- package/modules/jwplayerRtdProvider.js +71 -6
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +3 -1
- package/modules/loglyliftBidAdapter.js +79 -0
- package/modules/loglyliftBidAdapter.md +55 -0
- package/modules/nextMillenniumBidAdapter.js +3 -1
- package/modules/oguryBidAdapter.js +9 -2
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/optimeraRtdProvider.js +8 -1
- package/modules/ozoneBidAdapter.js +21 -64
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/richaudienceBidAdapter.js +3 -2
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +14 -15
- package/modules/rubiconAnalyticsAdapter.js +3 -2
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yahoosspBidAdapter.js +2 -0
- package/modules/yieldmoBidAdapter.js +23 -5
- package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
- package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
- package/package.json +1 -1
- package/src/adRendering.js +38 -0
- package/src/auction.js +44 -9
- package/src/config.js +27 -3
- package/src/hook.js +5 -1
- package/src/prebid.js +21 -21
- package/src/secureCreatives.js +114 -44
- package/src/utils.js +25 -4
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +148 -16
- package/test/spec/config_spec.js +279 -0
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +1 -0
- package/test/spec/modules/consentManagement_spec.js +20 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/currency_spec.js +21 -6
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gptPreAuction_spec.js +177 -2
- package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +42 -0
- package/test/spec/modules/ixBidAdapter_spec.js +104 -62
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
- package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
- package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/realTimeDataModule_spec.js +67 -5
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +1 -1
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +30 -0
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/unit/pbjs_api_spec.js +20 -2
- package/test/spec/unit/secureCreatives_spec.js +85 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: DisplayIO Bidder Adapter
|
|
5
|
+
Module Type: Bidder Adapter
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
# Description
|
|
9
|
+
|
|
10
|
+
Module that connects to display.io's demand sources.
|
|
11
|
+
Web mobile (not relevant for web desktop).
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#Features
|
|
15
|
+
| Feature | | Feature | |
|
|
16
|
+
|---------------|---------------------------------------------------------|-----------------------|-----|
|
|
17
|
+
| Bidder Code | displayio | Prebid member | no |
|
|
18
|
+
| Media Types | Banner, video. <br/>Sizes (display 320x480 / vertical video) | GVL ID | no |
|
|
19
|
+
| GDPR Support | yes | Prebid.js Adapter | yes |
|
|
20
|
+
| USP Support | yes | Prebid Server Adapter | no |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#Global configuration
|
|
24
|
+
```javascript
|
|
25
|
+
<head>
|
|
26
|
+
<script src="https://cdn.display.io/webis/webis.min.js"></script>
|
|
27
|
+
</head>
|
|
28
|
+
<script>
|
|
29
|
+
......................................
|
|
30
|
+
var CMP_TIMEOUT = 8000;
|
|
31
|
+
var consentManagement = {
|
|
32
|
+
gdpr: {
|
|
33
|
+
cmpApi: 'iab',
|
|
34
|
+
timeout: CMP_TIMEOUT,
|
|
35
|
+
defaultGdprScope: true
|
|
36
|
+
},
|
|
37
|
+
usp: {
|
|
38
|
+
cmpApi: 'iab',
|
|
39
|
+
timeout: CMP_TIMEOUT
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof __tcfapi !== 'function') {
|
|
44
|
+
delete consentManagement.gdpr;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pbjs.que.push(function() {
|
|
48
|
+
pbjs.setConfig({consentManagement})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
......................................
|
|
53
|
+
|
|
54
|
+
function initAdserver(bidResponses) {
|
|
55
|
+
if (pbjs.initAdserverSet) return;
|
|
56
|
+
pbjs.initAdserverSet = true;
|
|
57
|
+
|
|
58
|
+
...........................
|
|
59
|
+
|
|
60
|
+
const displayioBids = getDisplayioBid(bidResponses)
|
|
61
|
+
displayioBids.forEach(b => {
|
|
62
|
+
const {adData, placement} = b[1].bids[0];
|
|
63
|
+
webis.init(adData, b[0], {placement})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getDisplayioBid(bidResponses) {
|
|
69
|
+
const codes = adUnits.map(u => u.code);
|
|
70
|
+
const bids = Object.entries(bidResponses);
|
|
71
|
+
bids.filter(([key, value]) => codes.includes(key) && value.bids[0].bidderCode === 'displayio');
|
|
72
|
+
return bids;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
......................................
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# Bid Parameters
|
|
81
|
+
|
|
82
|
+
| Name | Scope | Type | Description | Example |
|
|
83
|
+
|----------------| ----- | ---- |----------------------------------------|-------------------------------|
|
|
84
|
+
| `siteId` | required | Number | SiteId and PlacementID are your inventory IDs on the display.io platform (please ask your Account Manager for your site and placement IDs). | 7753 |
|
|
85
|
+
| `placementId` | required | Number | SiteId and PlacementID are your inventory IDs on the display.io platform (please ask your Account Manager for your site and placement IDs). | 5375 |
|
|
86
|
+
| `adsSrvDomain` | required | String | | "appsrv.display.io" |
|
|
87
|
+
| `cdnDomain` | required | String | | "cdn.display.io" |
|
|
88
|
+
| `pageCategory` | optional | String | Comma-separated list of IAB content categories that describe the current page or view of the site, list of available values. | "pageCategory1, pageCategory2" |
|
|
89
|
+
| `keywords` | optional | String | Comma-separated list of keywords describing the content. | "keyword1, keyword2, keyword3" |
|
|
90
|
+
| `custom` | optional | Object | User-defined targeting key-value pairs. custom applies to a specific unit. | `{headerTextColor: "red", fixedHeaderSelector: '.site-header'}` |
|
|
91
|
+
| `custom.headerText`| optional | String | Ad container header text. By default, text is "Scroll to continue with content". Limited to 50 characters. | "Our awesome advertisement"|
|
|
92
|
+
| `custom.headerTextColor`| optional | String | Ad container header text color, "white" by default | "#2196f3"|
|
|
93
|
+
| `custom.headerBackgroundColor`| optional | String | Ad container header background color, "black" by default | "#fff" |
|
|
94
|
+
| `custom.adContainerBackgroundColor`| optional | String | Ad container body background color, "transparent" by default | "#000"|
|
|
95
|
+
| `custom.fixedHeaderSelector`| optional | String | In case your webpage has a fixed header – the header Id attribute or header class attribute should be defined as a value for parameter fixedHeaderSelector. | ".site-header"|
|
|
96
|
+
|
|
97
|
+
# adUnit configuration example
|
|
98
|
+
```javascript
|
|
99
|
+
var adUnits = [
|
|
100
|
+
{
|
|
101
|
+
code: 'ad-tag-1',
|
|
102
|
+
mediaTypes: {
|
|
103
|
+
banner: {
|
|
104
|
+
sizes: [[320, 480]]
|
|
105
|
+
},
|
|
106
|
+
video: {
|
|
107
|
+
sizes: [[360, 640]]
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
bids: [
|
|
111
|
+
{
|
|
112
|
+
bidder: 'displayio',
|
|
113
|
+
params: {
|
|
114
|
+
siteId: 1,
|
|
115
|
+
placementId: 1,
|
|
116
|
+
adsSrvDomain: 'appsrv.display.io',
|
|
117
|
+
cdnDomain: 'cdn.display.io',
|
|
118
|
+
pageCategory: 'pageCategory1, pageCategory2', //comma separated
|
|
119
|
+
keywords: 'keyword1, keyword2, keyword3', //comma separated
|
|
120
|
+
custom: {
|
|
121
|
+
headerText: 'Our awesome advertisement',
|
|
122
|
+
headerTextColor: '#2196f3',
|
|
123
|
+
headerBackgroundColor: 'black',
|
|
124
|
+
adContainerBackgroundColor: 'transparent',
|
|
125
|
+
fixedHeaderSelector: '.site-header',
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
// minimal required options
|
|
132
|
+
{
|
|
133
|
+
code: 'ad-tag-2',
|
|
134
|
+
bids: [{
|
|
135
|
+
bidder: 'displayio',
|
|
136
|
+
params: {
|
|
137
|
+
siteId: 1,
|
|
138
|
+
placementId: 1,
|
|
139
|
+
adsSrvDomain: 'appsrv.display.io',
|
|
140
|
+
cdnDomain: 'cdn.display.io',
|
|
141
|
+
}
|
|
142
|
+
}]
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
# Additional Details
|
|
148
|
+
[Mobile web prebid.js integration](https://www.display.io/documentation/mobile-web-prebid-js-integration/)
|
|
@@ -14,6 +14,13 @@ export const spec = {
|
|
|
14
14
|
const { placementId } = bid.params;
|
|
15
15
|
return !!placementId
|
|
16
16
|
},
|
|
17
|
+
isGdprConsentPresent: (bid) => {
|
|
18
|
+
const { gdpr, gdprConsent } = bid.params;
|
|
19
|
+
if (gdpr == '1') {
|
|
20
|
+
return !!gdprConsent
|
|
21
|
+
}
|
|
22
|
+
return true
|
|
23
|
+
},
|
|
17
24
|
buildRequests: (validBidRequests) => {
|
|
18
25
|
const serverRequests = [];
|
|
19
26
|
const { data } = config.getConfig('doceree.user')
|
|
@@ -21,7 +28,7 @@ export const spec = {
|
|
|
21
28
|
const encodedUserInfo = window.btoa(encodeURIComponent(JSON.stringify(data)))
|
|
22
29
|
|
|
23
30
|
validBidRequests.forEach(function(validBidRequest) {
|
|
24
|
-
const { publisherUrl, placementId } = validBidRequest.params;
|
|
31
|
+
const { publisherUrl, placementId, gdpr, gdprConsent } = validBidRequest.params;
|
|
25
32
|
const url = publisherUrl || page
|
|
26
33
|
let queryString = '';
|
|
27
34
|
queryString = tryAppendQueryString(queryString, 'id', placementId);
|
|
@@ -32,6 +39,8 @@ export const spec = {
|
|
|
32
39
|
queryString = tryAppendQueryString(queryString, 'prebidjs', true);
|
|
33
40
|
queryString = tryAppendQueryString(queryString, 'token', token);
|
|
34
41
|
queryString = tryAppendQueryString(queryString, 'requestId', validBidRequest.bidId);
|
|
42
|
+
queryString = tryAppendQueryString(queryString, 'gdpr', gdpr);
|
|
43
|
+
queryString = tryAppendQueryString(queryString, 'gdpr_consent', gdprConsent);
|
|
35
44
|
|
|
36
45
|
serverRequests.push({
|
|
37
46
|
method: 'GET',
|
|
@@ -25,6 +25,8 @@ var adUnits = [
|
|
|
25
25
|
params: {
|
|
26
26
|
placementId: 'DOC_7jm9j5eqkl0xvc5w', //required
|
|
27
27
|
publisherUrl: document.URL || window.location.href, //optional
|
|
28
|
+
gdpr: '1', //optional
|
|
29
|
+
gdprConsent:'CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g', //optional
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
]
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
|
|
3
|
+
import { isFn, deepAccess, logMessage } from '../src/utils.js';
|
|
4
|
+
|
|
5
|
+
const BIDDER_CODE = 'e_volution';
|
|
6
|
+
const AD_URL = 'https://service.e-volution.ai/?c=o&m=multi';
|
|
7
|
+
const URL_SYNC = 'https://service.e-volution.ai/?c=o&m=sync';
|
|
8
|
+
const NO_SYNC = true;
|
|
9
|
+
|
|
10
|
+
function isBidResponseValid(bid) {
|
|
11
|
+
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
|
|
12
|
+
!bid.ttl || !bid.currency) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
switch (bid.mediaType) {
|
|
16
|
+
case BANNER:
|
|
17
|
+
return Boolean(bid.width && bid.height && bid.ad);
|
|
18
|
+
case VIDEO:
|
|
19
|
+
return Boolean(bid.vastUrl);
|
|
20
|
+
case NATIVE:
|
|
21
|
+
return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers);
|
|
22
|
+
default:
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getBidFloor(bid) {
|
|
28
|
+
if (!isFn(bid.getFloor)) {
|
|
29
|
+
return deepAccess(bid, 'params.bidfloor', 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const bidFloor = bid.getFloor({
|
|
34
|
+
currency: 'USD',
|
|
35
|
+
mediaType: '*',
|
|
36
|
+
size: '*',
|
|
37
|
+
});
|
|
38
|
+
return bidFloor.floor;
|
|
39
|
+
} catch (_) {
|
|
40
|
+
return 0
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const spec = {
|
|
45
|
+
code: BIDDER_CODE,
|
|
46
|
+
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
|
|
47
|
+
noSync: NO_SYNC,
|
|
48
|
+
|
|
49
|
+
isBidRequestValid: (bid) => {
|
|
50
|
+
return Boolean(bid.bidId && bid.params && !isNaN(parseInt(bid.params.placementId)));
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
buildRequests: (validBidRequests = [], bidderRequest) => {
|
|
54
|
+
let winTop = window;
|
|
55
|
+
let location;
|
|
56
|
+
try {
|
|
57
|
+
location = new URL(bidderRequest.refererInfo.referer)
|
|
58
|
+
winTop = window.top;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
location = winTop.location;
|
|
61
|
+
logMessage(e);
|
|
62
|
+
};
|
|
63
|
+
let placements = [];
|
|
64
|
+
let request = {
|
|
65
|
+
'deviceWidth': winTop.screen.width,
|
|
66
|
+
'deviceHeight': winTop.screen.height,
|
|
67
|
+
'language': (navigator && navigator.language) ? navigator.language.split('-')[0] : '',
|
|
68
|
+
'secure': 1,
|
|
69
|
+
'host': location.host,
|
|
70
|
+
'page': location.pathname,
|
|
71
|
+
'placements': placements
|
|
72
|
+
};
|
|
73
|
+
if (bidderRequest) {
|
|
74
|
+
if (bidderRequest.uspConsent) {
|
|
75
|
+
request.ccpa = bidderRequest.uspConsent;
|
|
76
|
+
}
|
|
77
|
+
if (bidderRequest.gdprConsent) {
|
|
78
|
+
request.gdpr = bidderRequest.gdprConsent
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const len = validBidRequests.length;
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < len; i++) {
|
|
84
|
+
let bid = validBidRequests[i];
|
|
85
|
+
|
|
86
|
+
const placement = {
|
|
87
|
+
placementId: bid.params.placementId,
|
|
88
|
+
bidId: bid.bidId,
|
|
89
|
+
bidfloor: getBidFloor(bid)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (bid.mediaTypes && bid.mediaTypes[BANNER] && bid.mediaTypes[BANNER].sizes) {
|
|
93
|
+
placement.traffic = BANNER;
|
|
94
|
+
placement.sizes = bid.mediaTypes[BANNER].sizes;
|
|
95
|
+
} else if (bid.mediaTypes && bid.mediaTypes[VIDEO] && bid.mediaTypes[VIDEO].playerSize) {
|
|
96
|
+
placement.traffic = VIDEO;
|
|
97
|
+
placement.wPlayer = bid.mediaTypes[VIDEO].playerSize[0];
|
|
98
|
+
placement.hPlayer = bid.mediaTypes[VIDEO].playerSize[1];
|
|
99
|
+
placement.minduration = bid.mediaTypes[VIDEO].minduration;
|
|
100
|
+
placement.maxduration = bid.mediaTypes[VIDEO].maxduration;
|
|
101
|
+
placement.mimes = bid.mediaTypes[VIDEO].mimes;
|
|
102
|
+
placement.protocols = bid.mediaTypes[VIDEO].protocols;
|
|
103
|
+
placement.startdelay = bid.mediaTypes[VIDEO].startdelay;
|
|
104
|
+
placement.placement = bid.mediaTypes[VIDEO].placement;
|
|
105
|
+
placement.skip = bid.mediaTypes[VIDEO].skip;
|
|
106
|
+
placement.skipafter = bid.mediaTypes[VIDEO].skipafter;
|
|
107
|
+
placement.minbitrate = bid.mediaTypes[VIDEO].minbitrate;
|
|
108
|
+
placement.maxbitrate = bid.mediaTypes[VIDEO].maxbitrate;
|
|
109
|
+
placement.delivery = bid.mediaTypes[VIDEO].delivery;
|
|
110
|
+
placement.playbackmethod = bid.mediaTypes[VIDEO].playbackmethod;
|
|
111
|
+
placement.api = bid.mediaTypes[VIDEO].api;
|
|
112
|
+
placement.linearity = bid.mediaTypes[VIDEO].linearity;
|
|
113
|
+
} else if (bid.mediaTypes && bid.mediaTypes[NATIVE]) {
|
|
114
|
+
placement.traffic = NATIVE;
|
|
115
|
+
placement.native = bid.mediaTypes[NATIVE];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (bid.schain) {
|
|
119
|
+
placements.schain = bid.schain;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
placements.push(placement);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
url: AD_URL,
|
|
127
|
+
data: request
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
interpretResponse: (serverResponse) => {
|
|
132
|
+
let response = [];
|
|
133
|
+
for (let i = 0; i < serverResponse.body.length; i++) {
|
|
134
|
+
let resItem = serverResponse.body[i];
|
|
135
|
+
if (isBidResponseValid(resItem)) {
|
|
136
|
+
const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
|
|
137
|
+
resItem.meta = { ...resItem.meta, advertiserDomains };
|
|
138
|
+
|
|
139
|
+
response.push(resItem);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return response;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
getUserSyncs: (syncOptions, serverResponses) => {
|
|
146
|
+
if (NO_SYNC) {
|
|
147
|
+
return false
|
|
148
|
+
} else {
|
|
149
|
+
return [{
|
|
150
|
+
type: 'image',
|
|
151
|
+
url: URL_SYNC
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
registerBidder(spec);
|
|
@@ -40,28 +40,21 @@ export const spec = {
|
|
|
40
40
|
* @returns {ServerRequest}
|
|
41
41
|
*/
|
|
42
42
|
buildRequests: (validBidRequests, bidderRequest) => {
|
|
43
|
-
const demo = config.getConfig('glimpse.demo') || false
|
|
44
|
-
const account = config.getConfig('glimpse.account') || -1
|
|
45
|
-
const demand = config.getConfig('glimpse.demand') || 'glimpse'
|
|
46
|
-
const keywords = config.getConfig('glimpse.keywords') || {}
|
|
47
|
-
|
|
48
43
|
const auth = getVaultJwt()
|
|
49
44
|
const referer = getReferer(bidderRequest)
|
|
50
45
|
const gdprConsent = getGdprConsentChoice(bidderRequest)
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
})
|
|
46
|
+
const bidRequests = validBidRequests.map(processBidRequest)
|
|
47
|
+
const firstPartyData = getFirstPartyData()
|
|
54
48
|
|
|
55
49
|
const data = {
|
|
56
50
|
auth,
|
|
57
51
|
data: {
|
|
58
|
-
bidderCode: spec.code,
|
|
59
|
-
demo,
|
|
60
|
-
account,
|
|
61
|
-
demand,
|
|
62
52
|
referer,
|
|
63
53
|
gdprConsent,
|
|
64
|
-
|
|
54
|
+
bidRequests,
|
|
55
|
+
site: firstPartyData.site,
|
|
56
|
+
user: firstPartyData.user,
|
|
57
|
+
bidderCode: spec.code,
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
|
|
@@ -91,35 +84,12 @@ export const spec = {
|
|
|
91
84
|
},
|
|
92
85
|
}
|
|
93
86
|
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
const bidKeywords = bidRequest.params.keywords || {}
|
|
97
|
-
const keywords = {
|
|
98
|
-
...globalKeywords,
|
|
99
|
-
...bidKeywords,
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
unitCode: bidRequest.adUnitCode,
|
|
104
|
-
bidId: bidRequest.bidId,
|
|
105
|
-
placementId: bidRequest.params.placementId,
|
|
106
|
-
keywords,
|
|
107
|
-
sizes,
|
|
108
|
-
}
|
|
87
|
+
function setVaultJwt(auth) {
|
|
88
|
+
storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.vault.jwt, auth)
|
|
109
89
|
}
|
|
110
90
|
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
isArray(sizes) &&
|
|
114
|
-
sizes.length === 2 &&
|
|
115
|
-
!isArray(sizes[0]) &&
|
|
116
|
-
!isArray(sizes[1])
|
|
117
|
-
|
|
118
|
-
if (isSingleSize) {
|
|
119
|
-
return [sizes]
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return sizes
|
|
91
|
+
function getVaultJwt() {
|
|
92
|
+
return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.vault.jwt) || ''
|
|
123
93
|
}
|
|
124
94
|
|
|
125
95
|
function getReferer(bidderRequest) {
|
|
@@ -158,12 +128,64 @@ function getGdprConsentChoice(bidderRequest) {
|
|
|
158
128
|
}
|
|
159
129
|
}
|
|
160
130
|
|
|
161
|
-
function
|
|
162
|
-
|
|
131
|
+
function processBidRequest(bidRequest) {
|
|
132
|
+
const demand = bidRequest.params.demand || 'glimpse'
|
|
133
|
+
const sizes = normalizeSizes(bidRequest.sizes)
|
|
134
|
+
const keywords = bidRequest.params.keywords || {}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
demand,
|
|
138
|
+
sizes,
|
|
139
|
+
keywords,
|
|
140
|
+
bidId: bidRequest.bidId,
|
|
141
|
+
placementId: bidRequest.params.placementId,
|
|
142
|
+
unitCode: bidRequest.adUnitCode,
|
|
143
|
+
}
|
|
163
144
|
}
|
|
164
145
|
|
|
165
|
-
function
|
|
166
|
-
|
|
146
|
+
function normalizeSizes(sizes) {
|
|
147
|
+
const isSingleSize =
|
|
148
|
+
isArray(sizes) &&
|
|
149
|
+
sizes.length === 2 &&
|
|
150
|
+
!isArray(sizes[0]) &&
|
|
151
|
+
!isArray(sizes[1])
|
|
152
|
+
|
|
153
|
+
if (isSingleSize) {
|
|
154
|
+
return [sizes]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return sizes
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getFirstPartyData() {
|
|
161
|
+
const siteKeywords = parseGlobalKeywords('site')
|
|
162
|
+
const userKeywords = parseGlobalKeywords('user')
|
|
163
|
+
|
|
164
|
+
const siteAttributes = getConfig('ortb2.site.ext.data', {})
|
|
165
|
+
const userAttributes = getConfig('ortb2.user.ext.data', {})
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
site: {
|
|
169
|
+
keywords: siteKeywords,
|
|
170
|
+
attributes: siteAttributes,
|
|
171
|
+
},
|
|
172
|
+
user: {
|
|
173
|
+
keywords: userKeywords,
|
|
174
|
+
attributes: userAttributes,
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function parseGlobalKeywords(scope) {
|
|
180
|
+
const keywords = getConfig(`ortb2.${scope}.keywords`, '')
|
|
181
|
+
|
|
182
|
+
return keywords
|
|
183
|
+
.split(', ')
|
|
184
|
+
.filter((keyword) => keyword !== '')
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function getConfig(path, defaultValue) {
|
|
188
|
+
return config.getConfig(path) || defaultValue
|
|
167
189
|
}
|
|
168
190
|
|
|
169
191
|
function isValidBidResponse(bidResponse) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _each, parseSizesInput, isEmpty } from '../src/utils.js';
|
|
2
1
|
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { _each, isEmpty, parseSizesInput } from '../src/utils.js';
|
|
3
3
|
import { BANNER } from '../src/mediaTypes.js';
|
|
4
4
|
|
|
5
5
|
const BIDDER_CODE = 'gnet';
|
|
6
|
-
const ENDPOINT = 'https://
|
|
6
|
+
const ENDPOINT = 'https://service.gnetrtb.com/api/adrequest';
|
|
7
7
|
|
|
8
8
|
export const spec = {
|
|
9
9
|
code: BIDDER_CODE,
|
|
@@ -16,7 +16,7 @@ export const spec = {
|
|
|
16
16
|
* @return boolean True if this is a valid bid, and false otherwise.
|
|
17
17
|
*/
|
|
18
18
|
isBidRequestValid: function (bid) {
|
|
19
|
-
return !!(bid.params.websiteId);
|
|
19
|
+
return !!(bid.params.websiteId && bid.params.adunitId);
|
|
20
20
|
},
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
3
|
```
|
|
4
|
-
Module Name: Gnet Bidder Adapter
|
|
4
|
+
Module Name: Gnet RTB Bidder Adapter
|
|
5
5
|
Module Type: Bidder Adapter
|
|
6
|
-
Maintainer:
|
|
6
|
+
Maintainer: bruno.bonanho@grumft.com
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
# Description
|
|
10
10
|
|
|
11
|
-
Connect to Gnet
|
|
11
|
+
Connect to Gnet RTB exchange for bids.
|
|
12
12
|
|
|
13
13
|
# Test Parameters
|
|
14
14
|
```
|
|
@@ -24,7 +24,7 @@ Connect to Gnet Project exchange for bids.
|
|
|
24
24
|
{
|
|
25
25
|
bidder: 'gnet',
|
|
26
26
|
params: {
|
|
27
|
-
websiteId: '
|
|
27
|
+
websiteId: '1', adunitId: '1'
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
]
|
package/modules/gptPreAuction.js
CHANGED
|
@@ -48,10 +48,35 @@ const sanitizeSlotPath = (path) => {
|
|
|
48
48
|
return path;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
const defaultPreAuction = (adUnit, adServerAdSlot) => {
|
|
52
|
+
const context = adUnit.ortb2Imp.ext.data;
|
|
53
|
+
|
|
54
|
+
// use pbadslot if supplied
|
|
55
|
+
if (context.pbadslot) {
|
|
56
|
+
return context.pbadslot;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// confirm that GPT is set up
|
|
60
|
+
if (!isGptPubadsDefined()) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// find all GPT slots with this name
|
|
65
|
+
var gptSlots = window.googletag.pubads().getSlots().filter(slot => slot.getAdUnitPath() === adServerAdSlot);
|
|
66
|
+
|
|
67
|
+
if (gptSlots.length === 0) {
|
|
68
|
+
return; // should never happen
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (gptSlots.length === 1) {
|
|
72
|
+
return adServerAdSlot;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// else the adunit code must be div id. append it.
|
|
76
|
+
return `${adServerAdSlot}#${adUnit.code}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
51
79
|
export const appendPbAdSlot = adUnit => {
|
|
52
|
-
adUnit.ortb2Imp = adUnit.ortb2Imp || {};
|
|
53
|
-
adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {};
|
|
54
|
-
adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {};
|
|
55
80
|
const context = adUnit.ortb2Imp.ext.data;
|
|
56
81
|
const { customPbAdSlot } = _currentConfig;
|
|
57
82
|
|
|
@@ -84,11 +109,32 @@ export const appendPbAdSlot = adUnit => {
|
|
|
84
109
|
|
|
85
110
|
export const makeBidRequestsHook = (fn, adUnits, ...args) => {
|
|
86
111
|
appendGptSlots(adUnits);
|
|
112
|
+
const { useDefaultPreAuction, customPreAuction } = _currentConfig;
|
|
87
113
|
adUnits.forEach(adUnit => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
// init the ortb2Imp if not done yet
|
|
115
|
+
adUnit.ortb2Imp = adUnit.ortb2Imp || {};
|
|
116
|
+
adUnit.ortb2Imp.ext = adUnit.ortb2Imp.ext || {};
|
|
117
|
+
adUnit.ortb2Imp.ext.data = adUnit.ortb2Imp.ext.data || {};
|
|
118
|
+
const context = adUnit.ortb2Imp.ext;
|
|
119
|
+
|
|
120
|
+
// if neither new confs set do old stuff
|
|
121
|
+
if (!customPreAuction && !useDefaultPreAuction) {
|
|
122
|
+
const usedAdUnitCode = appendPbAdSlot(adUnit);
|
|
123
|
+
// gpid should be set to itself if already set, or to what pbadslot was (as long as it was not adUnit code)
|
|
124
|
+
if (!context.gpid && !usedAdUnitCode) {
|
|
125
|
+
context.gpid = context.data.pbadslot;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
let adserverSlot = deepAccess(context, 'data.adserver.adslot');
|
|
129
|
+
let result;
|
|
130
|
+
if (customPreAuction) {
|
|
131
|
+
result = customPreAuction(adUnit, adserverSlot);
|
|
132
|
+
} else if (useDefaultPreAuction) {
|
|
133
|
+
result = defaultPreAuction(adUnit, adserverSlot);
|
|
134
|
+
}
|
|
135
|
+
if (result) {
|
|
136
|
+
context.gpid = context.data.pbadslot = result;
|
|
137
|
+
}
|
|
92
138
|
}
|
|
93
139
|
});
|
|
94
140
|
return fn.call(this, adUnits, ...args);
|
|
@@ -100,6 +146,8 @@ const handleSetGptConfig = moduleConfig => {
|
|
|
100
146
|
'customGptSlotMatching', customGptSlotMatching =>
|
|
101
147
|
typeof customGptSlotMatching === 'function' && customGptSlotMatching,
|
|
102
148
|
'customPbAdSlot', customPbAdSlot => typeof customPbAdSlot === 'function' && customPbAdSlot,
|
|
149
|
+
'customPreAuction', customPreAuction => typeof customPreAuction === 'function' && customPreAuction,
|
|
150
|
+
'useDefaultPreAuction', useDefaultPreAuction => useDefaultPreAuction === true,
|
|
103
151
|
]);
|
|
104
152
|
|
|
105
153
|
if (_currentConfig.enabled) {
|