Skip to content

Commit 6b57f3c

Browse files
idanbotbolomerkoAnnaPerionoranperiontamirnPerion
authored and
Michele Nasti
committed
Undertone Bid Adapter : added GPP and video placements (prebid#10016)
* * Update undertone adapter - change parameters - placementId parameter is now optional and not mandatory - undertoneBidAdapter.js * Updated undertone bid adapter tests accordingly - undertoneBidAdapter_spec.js * * Update undertone adapter - change parameters - placementId parameter is now optional and not mandatory - undertoneBidAdapter.js * Updated undertone bid adapter tests accordingly - undertoneBidAdapter_spec.js * fix lint issue in undertone adapter spec * added user sync function to undertone adapter * * Update undertone adapter - change parameters - placementId parameter is now optional and not mandatory - undertoneBidAdapter.js * Updated undertone bid adapter tests accordingly - undertoneBidAdapter_spec.js * added user sync function to undertone adapter * added user sync function to undertone adapter * revert package-lock.json * added user sync function to undertone adapter * Update undertoneBidAdapter.js * Update browsers.json * Undertone: added GPP support and video plcmt * Fix lint issues --------- Co-authored-by: omerko <[email protected]> Co-authored-by: Omer Koren <[email protected]> Co-authored-by: AnnaPerion <[email protected]> Co-authored-by: Oran Hollaender <[email protected]> Co-authored-by: tamirnPerion <[email protected]> Co-authored-by: tamarm <[email protected]> Co-authored-by: tamarm <[email protected]>
1 parent 9c61cb9 commit 6b57f3c

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

modules/undertoneBidAdapter.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ export const spec = {
124124
reqUrl += `&ccpa=${bidderRequest.uspConsent}`;
125125
}
126126

127+
if (bidderRequest.gppConsent) {
128+
const gppString = bidderRequest.gppConsent.gppString ?? '';
129+
const ggpSid = bidderRequest.gppConsent.applicableSections ?? '';
130+
reqUrl += `&gpp=${gppString}&gpp_sid=${ggpSid}`;
131+
}
132+
127133
validBidRequests.map(bidReq => {
128134
const bid = {
129135
bidRequestId: bidReq.bidId,
@@ -146,7 +152,9 @@ export const spec = {
146152
streamType: deepAccess(bidReq, 'mediaTypes.video.context') || null,
147153
playbackMethod: deepAccess(bidReq, 'params.video.playbackMethod') || null,
148154
maxDuration: deepAccess(bidReq, 'params.video.maxDuration') || null,
149-
skippable: deepAccess(bidReq, 'params.video.skippable') || null
155+
skippable: deepAccess(bidReq, 'params.video.skippable') || null,
156+
placement: deepAccess(bidReq, 'mediaTypes.video.placement') || null,
157+
plcmt: deepAccess(bidReq, 'mediaTypes.video.plcmt') || null
150158
};
151159
}
152160
payload['x-ut-hb-params'].push(bid);

test/spec/modules/undertoneBidAdapter_spec.js

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const videoBidReq = [{
4141
},
4242
mediaTypes: {video: {
4343
context: 'outstream',
44-
playerSize: [640, 480]
44+
playerSize: [640, 480],
45+
placement: 1,
46+
plcmt: 1
4547
}},
4648
sizes: [[300, 250], [300, 600]],
4749
bidId: '263be71e91dd9d',
@@ -184,6 +186,31 @@ const bidderReqCcpaAndGdpr = {
184186
uspConsent: 'NY12'
185187
};
186188

189+
const bidderReqGpp = {
190+
refererInfo: {
191+
topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
192+
},
193+
gppConsent: {
194+
gppString: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN',
195+
applicableSections: [7]
196+
}
197+
};
198+
199+
const bidderReqFullGppCcpaGdpr = {
200+
refererInfo: {
201+
topmostLocation: 'http://prebid.org/dev-docs/bidder-adaptor.html'
202+
},
203+
gppConsent: {
204+
gppString: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN',
205+
applicableSections: [7]
206+
},
207+
gdprConsent: {
208+
gdprApplies: true,
209+
consentString: 'gdprConsent'
210+
},
211+
uspConsent: '1YNN'
212+
};
213+
187214
const validBidRes = {
188215
ad: '<div>Hello</div>',
189216
publisherId: 12345,
@@ -381,6 +408,31 @@ describe('Undertone Adapter', () => {
381408
expect(request.url).to.equal(REQ_URL);
382409
expect(request.method).to.equal('POST');
383410
});
411+
it(`should have gppConsent fields`, function () {
412+
const request = spec.buildRequests(bidReq, bidderReqGpp);
413+
const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
414+
const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
415+
const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
416+
const gppStr = bidderReqGpp.gppConsent.gppString;
417+
const gppSid = bidderReqGpp.gppConsent.applicableSections;
418+
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}&gpp=${gppStr}&gpp_sid=${gppSid}`;
419+
expect(request.url).to.equal(REQ_URL);
420+
expect(request.method).to.equal('POST');
421+
});
422+
it(`should have gpp, ccpa and gdpr fields`, function () {
423+
const request = spec.buildRequests(bidReq, bidderReqFullGppCcpaGdpr);
424+
const domainStart = bidderReq.refererInfo.topmostLocation.indexOf('//');
425+
const domainEnd = bidderReq.refererInfo.topmostLocation.indexOf('/', domainStart + 2);
426+
const domain = bidderReq.refererInfo.topmostLocation.substring(domainStart + 2, domainEnd);
427+
const gppStr = bidderReqFullGppCcpaGdpr.gppConsent.gppString;
428+
const gppSid = bidderReqFullGppCcpaGdpr.gppConsent.applicableSections;
429+
const ccpa = bidderReqFullGppCcpaGdpr.uspConsent;
430+
const gdpr = bidderReqFullGppCcpaGdpr.gdprConsent.gdprApplies ? 1 : 0;
431+
const gdprStr = bidderReqFullGppCcpaGdpr.gdprConsent.consentString;
432+
const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}&gdpr=${gdpr}&gdprstr=${gdprStr}&ccpa=${ccpa}&gpp=${gppStr}&gpp_sid=${gppSid}`;
433+
expect(request.url).to.equal(REQ_URL);
434+
expect(request.method).to.equal('POST');
435+
});
384436
it('should have all relevant fields', function () {
385437
const request = spec.buildRequests(bidReq, bidderReq);
386438
const bid1 = JSON.parse(request.data)['x-ut-hb-params'][0];
@@ -409,10 +461,14 @@ describe('Undertone Adapter', () => {
409461
expect(bidVideo.video.playbackMethod).to.equal(2);
410462
expect(bidVideo.video.maxDuration).to.equal(30);
411463
expect(bidVideo.video.skippable).to.equal(true);
464+
expect(bidVideo.video.placement).to.equal(1);
465+
expect(bidVideo.video.plcmt).to.equal(1);
412466

413467
expect(bidVideo2.video.skippable).to.equal(null);
414468
expect(bidVideo2.video.maxDuration).to.equal(null);
415469
expect(bidVideo2.video.playbackMethod).to.equal(null);
470+
expect(bidVideo2.video.placement).to.equal(null);
471+
expect(bidVideo2.video.plcmt).to.equal(null);
416472
});
417473
it('should send all userIds data to server', function () {
418474
const request = spec.buildRequests(bidReqUserIds, bidderReq);

0 commit comments

Comments
 (0)