Skip to content

Commit 88dbc04

Browse files
GeneGeniekrzysztofequativmcouroubleccorboReinoutStevens
authored
AdTelligent Bid Adapter: remove onefiftytwo alias (prebid#10025)
* Smartadserver Bid Adapter: support GPID (prebid#10004) * Smartadserver Bid Adapter: Add support for SDA user and site * Smartadserver Bid Adapter: Fix SDA support getConfig and add to unit testing * support floors per media type * Add GPP support * Rework payloads enriching * Add gpid support --------- Co-authored-by: Meven Courouble <[email protected]> Co-authored-by: Krzysztof Sokół <[email protected]> * chore: update default video placement value [PB-1560] (prebid#9948) Co-authored-by: Chris Corbo <[email protected]> * ShareThrough Bid Adapter : fix playerSize (prebid#10011) * fix sharethrough playersize * fix unit test --------- Co-authored-by: Reinout Stevens <[email protected]> * GrowthCode RTD : initial release (prebid#9852) * The New RTD Module * GrowthCode new RTD Module * Fixed to Prebid Added Testing Added Docs * Fixed to Prebid Added Testing Added Docs * Completed testing spec * Update the MD file to provide more infomation about what the module does * Update sample to point to the correct server for testing. * Stv Bid Adapter: add schain support (prebid#10010) * initial commit * adapted buildRequests function * refinement pfilter and bcat * refinement * adapted tests for isBidRequestValid,buildRequests * adaptations for test * finished building stvBidAdapter.js * finished: ran tests, coverage 99% * update: rename w->srw, h->srh * adapt stvBidAdapter.md * remove dspx from stv adapters * some changes (missing: getUserSyncs, but is the same as in radsBidAdapter) * added checks in getUserSyncs; ran tests * added schain support (94.8% coverage) * correct schain encoding --------- Co-authored-by: theo_ <theo_@IDEA3> * fix module type (prebid#10019) * Update ad generation adapter 1.6.0: update userSync (prebid#9984) * Update AdGenerationAdapter: update userSync * update test spec * remove onefiftytwo alias --------- Co-authored-by: Krzysztof Sokół <[email protected]> Co-authored-by: Meven Courouble <[email protected]> Co-authored-by: Krzysztof Sokół <[email protected]> Co-authored-by: ccorbo <[email protected]> Co-authored-by: Chris Corbo <[email protected]> Co-authored-by: Reinout Stevens <[email protected]> Co-authored-by: Reinout Stevens <[email protected]> Co-authored-by: southern-growthcode <[email protected]> Co-authored-by: theo-stv <[email protected]> Co-authored-by: theo_ <theo_@IDEA3> Co-authored-by: Chris Huie <[email protected]> Co-authored-by: Takaaki.Kojima <[email protected]>
1 parent 0b65cef commit 88dbc04

16 files changed

+503
-37
lines changed

integrationExamples/gpt/growthcode.html

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
<script async src="../../build/dev/prebid.js"></script>
88
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
99
<script>
10-
var FAILSAFE_TIMEOUT = 3300;
11-
var PREBID_TIMEOUT = 1000;
10+
var FAILSAFE_TIMEOUT = 33000;
11+
var PREBID_TIMEOUT = 10000;
1212

1313
var adUnits = [{
14+
debugging: {
15+
enabled: true
16+
},
1417
code: 'div-gpt-ad-1460505748561-0',
1518
mediaTypes: {
1619
banner: {
@@ -23,6 +26,11 @@
2326
params: {
2427
placementId: 13144370
2528
}
29+
},{
30+
bidder: 'criteo',
31+
params: {
32+
zoneId: 497747
33+
},
2634
}],
2735
}];
2836

@@ -67,12 +75,15 @@
6775
pbjs.setConfig({
6876
debugging: {
6977
enabled: true,
70-
bids: [{
71-
bidder: 'appnexus',
72-
adUnitCode: '/19968336/header-bid-tag-0',
73-
cpm: 1.5,
74-
adId: '111111',
75-
ad: '<html><body><img src="https://files.prebid.org/creatives/prebid300x250.png"></body></html>'
78+
},
79+
realTimeData: {
80+
auctionDelay: 1000,
81+
dataProviders: [{
82+
name: 'growthCodeRtd',
83+
waitForIt: true,
84+
params: {
85+
pid: 'TEST01',
86+
}
7687
}]
7788
},
7889
userSync: {
@@ -81,7 +92,7 @@
8192
storage: {
8293
type: "html5",
8394
name: "_sharedID", // create a cookie with this name
84-
expires: 365 // expires in 1 years
95+
expires: 365 // expires in 1 year
8596
}
8697
},{
8798
name: 'growthCodeId',

modules/adgenerationBidAdapter.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {tryAppendQueryString, getBidIdParameter, escapeUnsafeChars} from '../src/utils.js';
1+
import {tryAppendQueryString, getBidIdParameter, escapeUnsafeChars, deepAccess} from '../src/utils.js';
22
import {registerBidder} from '../src/adapters/bidderFactory.js';
33
import {BANNER, NATIVE} from '../src/mediaTypes.js';
44
import {config} from '../src/config.js';
5-
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
5+
import {convertOrtbRequestToProprietaryNative} from '../src/native.js';
66

77
const ADG_BIDDER_CODE = 'adgeneration';
88

@@ -21,14 +21,14 @@ export const spec = {
2121
},
2222
/**
2323
* Make a server request from the list of BidRequests.
24-
*
25-
* @param {validBidRequests[]} - an array of bids
24+
* @param validBidRequests
25+
* @param bidderRequest
2626
* @return ServerRequest Info describing the request to the server.
2727
*/
2828
buildRequests: function (validBidRequests, bidderRequest) {
2929
// convert Native ORTB definition to old-style prebid native definition
3030
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
31-
const ADGENE_PREBID_VERSION = '1.5.0';
31+
const ADGENE_PREBID_VERSION = '1.6.0';
3232
let serverRequests = [];
3333
for (let i = 0, len = validBidRequests.length; i < len; i++) {
3434
const validReq = validBidRequests[i];
@@ -38,6 +38,9 @@ export const spec = {
3838
const criteoId = getCriteoId(validReq);
3939
const id5id = getId5Id(validReq);
4040
const id5LinkType = getId5LinkType(validReq);
41+
const imuid = deepAccess(validReq, 'userId.imuid');
42+
const gpid = deepAccess(validReq, 'ortb2Imp.ext.gpid');
43+
const sua = deepAccess(validReq, 'ortb2.device.sua');
4144
let data = ``;
4245
data = tryAppendQueryString(data, 'posall', 'SSPLOC');
4346
const id = getBidIdParameter('id', validReq.params);
@@ -54,6 +57,12 @@ export const spec = {
5457
data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId);
5558
data = tryAppendQueryString(data, 'adgext_id5_id', id5id);
5659
data = tryAppendQueryString(data, 'adgext_id5_id_link_type', id5LinkType);
60+
data = tryAppendQueryString(data, 'adgext_imuid', imuid);
61+
data = tryAppendQueryString(data, 'adgext_uid2', validReq.userId ? validReq.userId.uid2 : null);
62+
data = tryAppendQueryString(data, 'gpid', gpid ? encodeURIComponent(gpid) : null);
63+
data = tryAppendQueryString(data, 'uach', sua ? JSON.stringify(sua) : null);
64+
data = tryAppendQueryString(data, 'schain', validReq.schain ? encodeURIComponent(JSON.stringify(validReq.schain)) : null);
65+
5766
// native以外にvideo等の対応が入った場合は要修正
5867
if (!validReq.mediaTypes || !validReq.mediaTypes.native) {
5968
data = tryAppendQueryString(data, 'imark', '1');

modules/adtelligentBidAdapter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const HOST_GETTERS = {
1717
}()),
1818
navelix: () => 'ghb.hb.navelix.com',
1919
appaloosa: () => 'ghb.hb.appaloosa.media',
20-
onefiftytwomedia: () => 'ghb.ads.152media.com',
2120
bidsxchange: () => 'ghb.hbd.bidsxchange.com',
2221
streamkey: () => 'ghb.hb.streamkey.net',
2322
janet: () => 'ghb.bidder.jmgads.com',
@@ -42,7 +41,6 @@ export const spec = {
4241
code: BIDDER_CODE,
4342
gvlid: 410,
4443
aliases: [
45-
'onefiftytwomedia',
4644
'appaloosa',
4745
'bidsxchange',
4846
'streamkey',

modules/growthCodeRtdProvider.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**
2+
* This module adds GrowthCode HEM and other Data to Bid Requests
3+
* @module modules/growthCodeRtdProvider
4+
*/
5+
import { submodule } from '../src/hook.js'
6+
import { getStorageManager } from '../src/storageManager.js';
7+
import {
8+
logMessage, logError, tryAppendQueryString, mergeDeep
9+
} from '../src/utils.js';
10+
import * as ajax from '../src/ajax.js';
11+
import { MODULE_TYPE_RTD } from '../src/activities/modules.js';
12+
13+
const MODULE_NAME = 'growthCodeRtd';
14+
const LOG_PREFIX = 'GrowthCodeRtd: ';
15+
const ENDPOINT_URL = 'https://p2.gcprivacy.com/v2/rtd?'
16+
const RTD_EXPIRE_KEY = 'gc_rtd_expires_at'
17+
const RTD_CACHE_KEY = 'gc_rtd_items'
18+
19+
export const storage = getStorageManager({ moduleType: MODULE_TYPE_RTD, moduleName: MODULE_NAME });
20+
let items
21+
22+
export const growthCodeRtdProvider = {
23+
name: MODULE_NAME,
24+
init: init,
25+
getBidRequestData: alterBidRequests,
26+
addData: addData,
27+
callServer: callServer
28+
};
29+
30+
/**
31+
* Parse json if possible, else return null
32+
* @param data
33+
* @returns {any|null}
34+
*/
35+
function tryParse(data) {
36+
try {
37+
return JSON.parse(data);
38+
} catch (err) {
39+
logError(err);
40+
return null;
41+
}
42+
}
43+
44+
/**
45+
* Init The RTD Module
46+
* @param config
47+
* @param userConsent
48+
* @returns {boolean}
49+
*/
50+
function init(config, userConsent) {
51+
logMessage(LOG_PREFIX + 'Init RTB');
52+
53+
if (config == null) {
54+
return false
55+
}
56+
57+
const configParams = (config && config.params) || {};
58+
let expiresAt = parseInt(storage.getDataFromLocalStorage(RTD_EXPIRE_KEY, null));
59+
60+
items = tryParse(storage.getDataFromLocalStorage(RTD_CACHE_KEY, null));
61+
62+
return callServer(configParams, items, expiresAt, userConsent);
63+
}
64+
function callServer(configParams, items, expiresAt, userConsent) {
65+
// Expire Cache
66+
let now = Math.trunc(Date.now() / 1000);
67+
if ((!isNaN(expiresAt)) && (now > expiresAt)) {
68+
expiresAt = NaN;
69+
storage.removeDataFromLocalStorage(RTD_CACHE_KEY, null)
70+
storage.removeDataFromLocalStorage(RTD_EXPIRE_KEY, null)
71+
}
72+
if ((items === null) && (isNaN(expiresAt))) {
73+
let gcid = localStorage.getItem('gcid')
74+
75+
let url = configParams.url ? configParams.url : ENDPOINT_URL;
76+
url = tryAppendQueryString(url, 'pid', configParams.pid);
77+
url = tryAppendQueryString(url, 'u', window.location.href);
78+
url = tryAppendQueryString(url, 'gcid', gcid);
79+
if ((userConsent !== null) && (userConsent.gdpr !== null) && (userConsent.gdpr.consentData.getTCData.tcString)) {
80+
url = tryAppendQueryString(url, 'tcf', userConsent.gdpr.consentData.getTCData.tcString)
81+
}
82+
83+
ajax.ajaxBuilder()(url, {
84+
success: response => {
85+
let respJson = tryParse(response);
86+
// If response is a valid json and should save is true
87+
if (respJson && respJson.results >= 1) {
88+
storage.setDataInLocalStorage(RTD_CACHE_KEY, JSON.stringify(respJson.items), null);
89+
storage.setDataInLocalStorage(RTD_EXPIRE_KEY, respJson.expires_at, null)
90+
} else {
91+
storage.setDataInLocalStorage(RTD_EXPIRE_KEY, respJson.expires_at, null)
92+
}
93+
},
94+
error: error => {
95+
logError(LOG_PREFIX + 'ID fetch encountered an error', error);
96+
}
97+
}, undefined, {method: 'GET', withCredentials: true})
98+
}
99+
100+
return true;
101+
}
102+
103+
function addData(reqBidsConfigObj, items) {
104+
let merge = false
105+
106+
for (let j = 0; j < items.length; j++) {
107+
let item = items[j]
108+
let data = JSON.parse(item.parameters);
109+
if (item['attachment_point'] === 'data') {
110+
mergeDeep(reqBidsConfigObj.ortb2Fragments.bidder, data)
111+
merge = true
112+
}
113+
}
114+
return merge
115+
}
116+
117+
/**
118+
* Alter the Bid Request for additional information such as HEM or 3rd Party Ids
119+
* @param reqBidsConfigObj
120+
* @param callback
121+
* @param config
122+
* @param userConsent
123+
*/
124+
function alterBidRequests(reqBidsConfigObj, callback, config, userConsent) {
125+
if (items != null) {
126+
addData(reqBidsConfigObj, items)
127+
}
128+
callback();
129+
}
130+
131+
submodule('realTimeData', growthCodeRtdProvider);

modules/growthCodeRtdProvider.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## GrowthCode Real-time Data Submodule
2+
3+
The [GrowthCode](https://growthcode.io) real-time data module in Prebid enables publishers to fully
4+
leverage the potential of their first-party audiences and contextual data.
5+
With an integrated cookieless GrowthCode identity, this module offers real-time
6+
contextual and audience segmentation (IAB Taxonomy 2.2, cattax: 6) capabilities, and HEMs that can seamlessly
7+
integrate into your existing Prebid deployment, making it easy to maximize
8+
your advertising strategies.
9+
10+
## Building Prebid with GrowthCode Support
11+
12+
Compile the GrowthCode RTD module into your Prebid build:
13+
14+
`gulp serve --modules=userId,rtdModule,appnexusBidAdapter,growthCodeRtdProvider,sharedIdSystem,criteoBidAdapter`
15+
16+
Please visit https://growthcode.io/ for more information.
17+
18+
```
19+
pbjs.setConfig(
20+
...
21+
realTimeData: {
22+
auctionDelay: 1000,
23+
dataProviders: [
24+
{
25+
name: 'growthCodeRtd',
26+
waitForIt: true,
27+
params: {
28+
pid: 'TEST01',
29+
}
30+
}
31+
]
32+
}
33+
...
34+
}
35+
```
36+
37+
### Parameter Descriptions for the GrowthCode Configuration Section
38+
39+
| Name | Type | Description | Notes |
40+
|:---------------------------------|:--------|:--------------------------------------------------------------------------|:----------------------------|
41+
| name | String | Real time data module name | Always 'growthCodeRtd' |
42+
| waitForIt | Boolean | Required to ensure that the auction is delayed until prefetch is complete | Optional. Defaults to false |
43+
| params | Object | | |
44+
| params.pid | String | This is the Parter ID value obtained from GrowthCode | `TEST01` |
45+
| params.url | String | Custom URL for server | Optional |
46+
47+
## Testing
48+
49+
To view an example of GrowthCode backends:
50+
51+
`gulp serve --modules=userId,rtdModule,appnexusBidAdapter,growthCodeRtdProvider,sharedIdSystem,criteoBidAdapter`
52+
53+
and then point your browser at:
54+
55+
`http://localhost:9999/integrationExamples/gpt/growthcode.html`

modules/ixBidAdapter.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export const FEATURE_TOGGLES = {
145145
let siteID = 0;
146146
let gdprConsent = '';
147147
let usPrivacy = '';
148+
let defaultVideoPlacement = false;
148149

149150
// Possible values for bidResponse.seatBid[].bid[].mtype which indicates the type of the creative markup so that it can properly be associated with the right sub-object of the BidRequest.Imp.
150151
const MEDIA_TYPES = {
@@ -223,7 +224,8 @@ function bidToVideoImp(bid) {
223224
if (deepAccess(videoParamRef, 'playerConfig.floatOnScroll')) {
224225
imp.video.placement = 5;
225226
} else {
226-
imp.video.placement = 4;
227+
imp.video.placement = 3;
228+
defaultVideoPlacement = true;
227229
}
228230
} else {
229231
logWarn(`IX Bid Adapter: Video context '${context}' is not supported`);
@@ -1112,7 +1114,8 @@ function buildIXDiag(validBidRequests) {
11121114
ren: false,
11131115
version: '$prebid.version$',
11141116
userIds: _getUserIds(validBidRequests[0]),
1115-
url: window.location.href.split('?')[0]
1117+
url: window.location.href.split('?')[0],
1118+
vpd: defaultVideoPlacement
11161119
};
11171120

11181121
// create ad unit map and collect the required diag properties

modules/sharethroughBidAdapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export const sharethroughAdapterSpec = {
9393
if (videoRequest) {
9494
// default playerSize, only change this if we know width and height are properly defined in the request
9595
let [w, h] = [640, 360];
96-
if (videoRequest.playerSize && videoRequest.playerSize[0] && videoRequest.playerSize[1]) {
97-
[w, h] = videoRequest.playerSize;
96+
if (videoRequest.playerSize && videoRequest.playerSize[0] && videoRequest.playerSize[0][0] && videoRequest.playerSize[0][1]) {
97+
[w, h] = videoRequest.playerSize[0];
9898
}
9999

100100
impression.video = {

modules/smartadserverBidAdapter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ export const spec = {
159159
sdc: sellerDefinedContext
160160
};
161161

162+
const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid', deepAccess(bid, 'ortb2Imp.ext.data.pbadslot', ''));
163+
if (gpid) {
164+
payload.gpid = gpid;
165+
}
166+
162167
if (bidderRequest) {
163168
if (bidderRequest.gdprConsent) {
164169
payload.addtl_consent = bidderRequest.gdprConsent.addtlConsent;

0 commit comments

Comments
 (0)