Skip to content

Commit 14a60a6

Browse files
authored
Merge branch 'master' into apsBidAdapter/v2.1.0
2 parents c09a8d1 + a6e74cf commit 14a60a6

9 files changed

Lines changed: 225 additions & 190 deletions

modules/gumgumBidAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ function _getDeviceData(ortb2Data) {
288288
model: _device.model,
289289
ppi: _device.ppi,
290290
pxratio: _device.pxratio,
291+
lmt: _device.lmt,
292+
ifa: _device.lmt !== 1 ? _device.ifa : undefined,
291293
foddid: _device?.ext?.fiftyonedegrees_deviceId,
292294
};
293295

modules/mediaeyesBidAdapter.js

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
2-
BANNER
2+
BANNER,
3+
VIDEO
34
} from '../src/mediaTypes.js';
45
import {
56
registerBidder
@@ -10,7 +11,7 @@ const ENDPOINT_URL = 'https://delivery.upremium.asia/ortb/open/auction';
1011

1112
export const spec = {
1213
code: 'mediaeyes',
13-
supportedMediaTypes: BANNER,
14+
supportedMediaTypes: [BANNER, VIDEO],
1415

1516
isBidRequestValid: (bid) => {
1617
return !!(bid.params.itemId);
@@ -57,10 +58,24 @@ export const spec = {
5758
netRevenue: true
5859
};
5960

60-
prBid.mediaType = BANNER;
61+
let mediaType = rtbBid.ext?.mediaType;
62+
if (!mediaType) {
63+
if (rtbBid.adm && rtbBid.adm.includes('<VAST')) {
64+
mediaType = VIDEO;
65+
} else {
66+
mediaType = BANNER;
67+
}
68+
}
69+
70+
if (mediaType === VIDEO) {
71+
prBid.mediaType = VIDEO;
72+
prBid.vastXml = rtbBid.adm;
73+
} else {
74+
prBid.mediaType = BANNER;
75+
prBid.ad = rtbBid.adm;
76+
}
6177
prBid.width = rtbBid.w;
6278
prBid.height = rtbBid.h;
63-
prBid.ad = rtbBid.adm;
6479
if (isArray(rtbBid.adomain)) {
6580
deepSetValue(prBid, 'meta.advertiserDomains', rtbBid.adomain);
6681
}
@@ -96,7 +111,13 @@ function cookingImp(bidReq) {
96111

97112
imp.id = bidReq.bidId;
98113
imp.bidfloor = bidfloor;
99-
imp.banner = cookImpBanner(bidReq);
114+
if (bidReq.mediaTypes?.banner) {
115+
imp.banner = cookImpBanner(bidReq);
116+
}
117+
118+
if (bidReq.mediaTypes?.video) {
119+
imp.video = cookImpVideo(bidReq);
120+
}
100121
}
101122
return imp;
102123
}
@@ -111,6 +132,33 @@ const cookImpBanner = ({ mediaTypes, params }) => {
111132
}
112133
};
113134

135+
function cookImpVideo({ mediaTypes }) {
136+
const video = mediaTypes.video;
137+
138+
const size = Array.isArray(video.playerSize[0])
139+
? video.playerSize[0]
140+
: video.playerSize;
141+
142+
const [w, h] = size;
143+
144+
let placement = video.placement;
145+
if (!placement && video.context) {
146+
if (video.context === 'outstream') {
147+
placement = 4;
148+
} else if (video.context === 'instream') {
149+
placement = 1;
150+
}
151+
}
152+
153+
return {
154+
w,
155+
h,
156+
mimes: video.mimes || ['video/mp4'],
157+
protocols: video.protocols || [2, 3, 5, 6],
158+
placement: video.placement || 1
159+
};
160+
}
161+
114162
function getBidFloor(bidRequest) {
115163
let bidfloor = deepAccess(bidRequest, 'params.bidFloor', 0)
116164

modules/mediaeyesBidAdapter.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ Module that connects to MediaEyes Bidder System
3131
},
3232
];
3333
```
34+
35+
```
36+
var adUnits = [
37+
{
38+
code: "video-zone",
39+
mediaTypes: {
40+
video: {
41+
context: "instream",
42+
playerSize: [640, 480]
43+
}
44+
},
45+
bids: [{
46+
bidder: "mediaeyes",
47+
params: {
48+
itemId: "4d27f3cc8bbd5bd153045e",
49+
bidFloor: 0.01
50+
}
51+
}]
52+
}
53+
];
54+
```

modules/pubstackBidAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const getUserSyncs: GetUserSyncFn = (syncOptions, _serverResponses, gdprConsent,
143143

144144
export const spec: BidderSpec<typeof BIDDER_CODE> = {
145145
code: BIDDER_CODE,
146-
aliases: [ {code: `${BIDDER_CODE}_server`, gvlid: GVLID} ],
146+
aliases: [{ code: `${BIDDER_CODE}_server`, gvlid: GVLID }],
147147
gvlid: GVLID,
148148
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
149149
isBidRequestValid,

modules/wurflRtdProvider.js

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { getGlobal } from '../src/prebidGlobal.js';
1313
// Constants
1414
const REAL_TIME_MODULE = 'realTimeData';
1515
const MODULE_NAME = 'wurfl';
16-
const MODULE_VERSION = '2.4.0';
16+
const MODULE_VERSION = '2.6.0';
1717

1818
// WURFL_JS_HOST is the host for the WURFL service endpoints
1919
const WURFL_JS_HOST = 'https://prebid.wurflcloud.com';
@@ -50,6 +50,7 @@ const ORTB2_DEVICE_FIELDS = [
5050
const ENRICHMENT_TYPE = {
5151
UNKNOWN: 'unknown',
5252
NONE: 'none',
53+
NONE_LCE: 'none_lce',
5354
LCE: 'lce',
5455
LCE_ERROR: 'lcefailed',
5556
WURFL_PUB: 'wurfl_pub',
@@ -76,8 +77,6 @@ const AB_TEST = {
7677
TREATMENT_GROUP: 'treatment',
7778
DEFAULT_SPLIT: 0.5,
7879
DEFAULT_NAME: 'unknown',
79-
ENRICHMENT_TYPE_LCE: 'lce',
80-
ENRICHMENT_TYPE_WURFL: 'wurfl'
8180
};
8281

8382
const logger = prefixLog('[WURFL RTD Submodule]');
@@ -1023,8 +1022,6 @@ const ABTestManager = {
10231022
_enabled: false,
10241023
_name: null,
10251024
_variant: null,
1026-
_excludeLCE: true,
1027-
_enrichmentType: null,
10281025

10291026
/**
10301027
* Initializes A/B test configuration
@@ -1034,8 +1031,6 @@ const ABTestManager = {
10341031
this._enabled = false;
10351032
this._name = null;
10361033
this._variant = null;
1037-
this._excludeLCE = true;
1038-
this._enrichmentType = null;
10391034

10401035
const abTestEnabled = params?.abTest ?? false;
10411036
if (!abTestEnabled) {
@@ -1044,12 +1039,11 @@ const ABTestManager = {
10441039

10451040
this._enabled = true;
10461041
this._name = params?.abName ?? AB_TEST.DEFAULT_NAME;
1047-
this._excludeLCE = params?.abExcludeLCE ?? true;
10481042

10491043
const split = params?.abSplit ?? AB_TEST.DEFAULT_SPLIT;
10501044
this._variant = this._computeVariant(split);
10511045

1052-
logger.logMessage(`A/B test "${this._name}": user in ${this._variant} group (exclude_lce: ${this._excludeLCE})`);
1046+
logger.logMessage(`A/B test "${this._name}": user in ${this._variant} group`);
10531047
},
10541048

10551049
/**
@@ -1067,24 +1061,12 @@ const ABTestManager = {
10671061
return Math.random() < split ? AB_TEST.TREATMENT_GROUP : AB_TEST.CONTROL_GROUP;
10681062
},
10691063

1070-
/**
1071-
* Sets the enrichment type encountered in current auction
1072-
* @param {string} enrichmentType 'lce' or 'wurfl'
1073-
*/
1074-
setEnrichmentType(enrichmentType) {
1075-
this._enrichmentType = enrichmentType;
1076-
},
1077-
10781064
/**
10791065
* Checks if A/B test is enabled for current auction
10801066
* @returns {boolean} True if A/B test should be applied
10811067
*/
10821068
isEnabled() {
1083-
if (!this._enabled) return false;
1084-
if (this._enrichmentType === AB_TEST.ENRICHMENT_TYPE_LCE && this._excludeLCE) {
1085-
return false;
1086-
}
1087-
return true;
1069+
return this._enabled;
10881070
},
10891071

10901072
/**
@@ -1168,14 +1150,21 @@ const getBidRequestData = (reqBidsConfigObj, callback, config, userConsent) => {
11681150
const cachedWurflData = getObjectFromStorage(WURFL_RTD_STORAGE_KEY);
11691151
WurflDebugger.cacheReadStop();
11701152

1171-
const abEnrichmentType = cachedWurflData ? AB_TEST.ENRICHMENT_TYPE_WURFL : AB_TEST.ENRICHMENT_TYPE_LCE;
1172-
ABTestManager.setEnrichmentType(abEnrichmentType);
1173-
11741153
// A/B test: Skip enrichment for control group
11751154
if (ABTestManager.isInControlGroup()) {
11761155
logger.logMessage('A/B test control group: skipping enrichment');
1177-
enrichmentType = ENRICHMENT_TYPE.NONE;
1178-
bidders.forEach(bidder => bidderEnrichment.set(bidder, ENRICHMENT_TYPE.NONE));
1156+
const controlEnrichment = cachedWurflData ? ENRICHMENT_TYPE.NONE : ENRICHMENT_TYPE.NONE_LCE;
1157+
enrichmentType = controlEnrichment;
1158+
bidders.forEach(bidder => bidderEnrichment.set(bidder, controlEnrichment));
1159+
1160+
// Read cache metadata for beacon reporting (without enriching bid request)
1161+
if (cachedWurflData) {
1162+
wurflId = cachedWurflData.WURFL?.wurfl_id || '';
1163+
samplingRate = cachedWurflData.wurfl_pbjs?.sampling_rate ?? DEFAULT_SAMPLING_RATE;
1164+
tier = cachedWurflData.wurfl_pbjs?.tier ?? '';
1165+
overQuota = cachedWurflData.wurfl_pbjs?.over_quota ?? DEFAULT_OVER_QUOTA;
1166+
}
1167+
11791168
WurflDebugger.moduleExecutionStop();
11801169
callback();
11811170
return;

test/spec/modules/gamAdServerVideo_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ describe('The DFP video support module', function () {
901901
);
902902
server.respondWith(gamWrapper);
903903

904-
const result = getVastXml({url, adUnit: {}, bid: {}, params: {iu: '/19968336/prebid_cache_video_adunit'}}, []).then(() => {
904+
const result = getVastXml({ url, adUnit: {}, bid: {}, params: { iu: '/19968336/prebid_cache_video_adunit' } }, []).then(() => {
905905
const request = server.requests[0];
906906
const url = new URL(request.url);
907907
return url.searchParams.get('us_privacy');
@@ -913,7 +913,7 @@ describe('The DFP video support module', function () {
913913

914914
function obtainUsPrivacyInGamVideoUrl() {
915915
const url = 'https://pubads.g.doubleclick.net/gampad/ads'
916-
return new URLSearchParams(buildDfpVideoUrl({url, adUnit: {}, bid: {}, params: {iu: '/19968336/prebid_cache_video_adunit'}})).get('us_privacy');
916+
return new URLSearchParams(buildDfpVideoUrl({ url, adUnit: {}, bid: {}, params: { iu: '/19968336/prebid_cache_video_adunit' } })).get('us_privacy');
917917
}
918918

919919
function mockGpp(gpp) {

test/spec/modules/gumgumBidAdapter_spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,8 @@ describe('gumgumAdapter', function () {
12911291
ext: { fiftyonedegrees_deviceId: '17595-133085-133468-18092' },
12921292
ip: '127.0.0.1',
12931293
ipv6: '51dc:5e20:fd6a:c955:66be:03b4:dfa3:35b2',
1294+
lmt: 1,
1295+
ifa: 'test-ifa-id',
12941296
sua: suaObject
12951297

12961298
},
@@ -1309,11 +1311,25 @@ describe('gumgumAdapter', function () {
13091311
expect(bidRequest.data.foddid).to.equal(ortb2.device.ext.fiftyonedegrees_deviceId);
13101312
expect(bidRequest.data.ip).to.equal(ortb2.device.ip);
13111313
expect(bidRequest.data.ipv6).to.equal(ortb2.device.ipv6);
1314+
expect(bidRequest.data.lmt).to.equal(ortb2.device.lmt);
1315+
expect(bidRequest.data).to.not.have.property('ifa');
13121316
expect(bidRequest.data).to.have.property('sua');
13131317
expect(() => JSON.parse(bidRequest.data.sua)).to.not.throw();
13141318
expect(JSON.parse(bidRequest.data.sua)).to.deep.equal(suaObject);
13151319
});
13161320

1321+
it('should include ifa when lmt is not 1', function () {
1322+
const ortb2 = {
1323+
device: {
1324+
lmt: 0,
1325+
ifa: 'test-ifa-id'
1326+
}
1327+
};
1328+
const bidRequest = spec.buildRequests(bidRequests, { ortb2 })[0];
1329+
expect(bidRequest.data.lmt).to.equal(0);
1330+
expect(bidRequest.data.ifa).to.equal('test-ifa-id');
1331+
});
1332+
13171333
it('should set tId from ortb2Imp.ext.tid if available', function () {
13181334
const ortb2Imp = { ext: { tid: 'test-tid-1' } };
13191335
const request = { ...bidRequests[0], ortb2Imp };

0 commit comments

Comments
 (0)