From 6c65639531f5c1e166f6bd9bd5cd953e98bee444 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Tue, 7 Feb 2023 16:26:01 +0800 Subject: [PATCH 01/14] FreeWheel add floor price --- modules/freewheel-sspBidAdapter.js | 31 ++++++++++++++++++- .../modules/freewheel-sspBidAdapter_spec.js | 28 ++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index b4d8f69d1b4..b189eb387b7 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -1,6 +1,7 @@ -import { logWarn, isArray } from '../src/utils.js'; +import { logWarn, isArray, isFn, deepAccess } from '../src/utils.js'; import { BANNER, VIDEO } from '../src/mediaTypes.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; +import { config } from '../src/config.js'; const BIDDER_CODE = 'freewheel-ssp'; @@ -213,6 +214,27 @@ function getAPIName(componentId) { return componentId.replace('-', ''); } +function getBidFloor(bid, config) { + if (!isFn(bid.getFloor)) { + return deepAccess(bid, 'params.bidfloor', 0); + } + + try { + const bidFloor = bid.getFloor({ + currency: getFloorCurrency(config), + mediaType: typeof bid.mediaTypes['banner'] == 'object' ? 'banner' : 'video', + size: '*', + }); + return bidFloor.floor; + } catch (e) { + return -1; + } +} + +function getFloorCurrency(config) { + return config.getConfig('floors.data.currency') != null ? config.getConfig('floors.data.currency') : 'USD'; +} + function formatAdHTML(bid, size) { var integrationType = bid.params.format; @@ -317,6 +339,11 @@ export const spec = { var zone = currentBidRequest.params.zoneId; var timeInMillis = new Date().getTime(); var keyCode = hashcode(zone + '' + timeInMillis); + var bidfloor = getBidFloor(currentBidRequest, config); + + logWarn('wx test 2'); + logWarn(bidfloor); + var requestParams = { reqType: 'AdsSetup', protocolVersion: '2.0', @@ -324,6 +351,8 @@ export const spec = { componentId: 'prebid', componentSubId: getComponentId(currentBidRequest.params.format), timestamp: timeInMillis, + _fw_bidfloor: (bidfloor > 0) ? bidfloor : 0, + _fw_bidfloorcur: (bidfloor > 0) ? getFloorCurrency(config) : '', pKey: keyCode }; diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index d1e0b055239..67638cfc44b 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -84,7 +84,8 @@ describe('freewheelSSP BidAdapter Test', () => { { 'bidder': 'freewheel-ssp', 'params': { - 'zoneId': '277225' + 'zoneId': '277225', + 'bidfloor': 2.00, }, 'adUnitCode': 'adunit-code', 'mediaTypes': { @@ -114,6 +115,31 @@ describe('freewheelSSP BidAdapter Test', () => { } ]; + it('should get bidfloor value from params if no getFloor method', () => { + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload._fw_bidfloor).to.equal(2.00); + expect(payload._fw_bidfloorcur).to.deep.equal('USD'); + }); + + it('should get bidfloor value from getFloor method if available', () => { + const bidRequest = bidRequests[0]; + bidRequest.getFloor = () => ({ currency: 'USD', floor: 1.16 }); + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload._fw_bidfloor).to.equal(1.16); + expect(payload._fw_bidfloorcur).to.deep.equal('USD'); + }); + + it('should return empty bidFloorCurrency when bidfloor <= 0', () => { + const bidRequest = bidRequests[0]; + bidRequest.getFloor = () => ({ currency: 'USD', floor: -1 }); + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload._fw_bidfloor).to.equal(0); + expect(payload._fw_bidfloorcur).to.deep.equal(''); + }); + it('should add parameters to the tag', () => { const request = spec.buildRequests(bidRequests); const payload = request[0].data; From 16863e7ed4d3acbd41eef0f88f4259e82e088fce Mon Sep 17 00:00:00 2001 From: xuanwang Date: Tue, 7 Feb 2023 16:29:38 +0800 Subject: [PATCH 02/14] FreeWheel code update --- modules/freewheel-sspBidAdapter.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index b189eb387b7..af799012c58 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -341,9 +341,6 @@ export const spec = { var keyCode = hashcode(zone + '' + timeInMillis); var bidfloor = getBidFloor(currentBidRequest, config); - logWarn('wx test 2'); - logWarn(bidfloor); - var requestParams = { reqType: 'AdsSetup', protocolVersion: '2.0', From 67b4f50c9c8433c97b0a22bb9b61712f13ffe025 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Tue, 14 Feb 2023 14:02:59 +0800 Subject: [PATCH 03/14] FreeWheel-SSP-Adapter: Update to use Vast 4.2 by default --- modules/freewheel-sspBidAdapter.js | 2 +- .../modules/freewheel-sspBidAdapter_spec.js | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index af799012c58..1a962fd4060 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -343,7 +343,7 @@ export const spec = { var requestParams = { reqType: 'AdsSetup', - protocolVersion: '2.0', + protocolVersion: '4.2', zoneId: zone, componentId: 'prebid', componentSubId: getComponentId(currentBidRequest.params.format), diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 67638cfc44b..4d0c87ace3a 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -144,7 +144,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -170,7 +170,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests, bidderRequest); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -190,7 +190,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests, bidderRequest); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -237,7 +237,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -257,7 +257,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests, bidderRequest); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -277,7 +277,7 @@ describe('freewheelSSP BidAdapter Test', () => { const request = spec.buildRequests(bidRequests, bidderRequest); const payload = request[0].data; expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.protocolVersion).to.equal('4.2'); expect(payload.zoneId).to.equal('277225'); expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); @@ -363,7 +363,7 @@ describe('freewheelSSP BidAdapter Test', () => { } ]; - let response = '' + + let response = '' + '' + ' ' + ' Adswizz' + @@ -448,7 +448,7 @@ describe('freewheelSSP BidAdapter Test', () => { it('handles nobid responses', () => { var request = spec.buildRequests(formattedBidRequests); - let response = ''; + let response = ''; let result = spec.interpretResponse(response, request[0]); expect(result.length).to.equal(0); @@ -529,7 +529,7 @@ describe('freewheelSSP BidAdapter Test', () => { } ]; - let response = '' + + let response = '' + '' + ' ' + ' Adswizz' + @@ -625,7 +625,7 @@ describe('freewheelSSP BidAdapter Test', () => { it('handles nobid responses', () => { var request = spec.buildRequests(formattedBidRequests); - let response = ''; + let response = ''; let result = spec.interpretResponse(response, request[0]); expect(result.length).to.equal(0); From 63cb73f591de653078eab867f6e027403a2c320d Mon Sep 17 00:00:00 2001 From: xuanwang Date: Mon, 13 Mar 2023 13:20:51 +0800 Subject: [PATCH 04/14] FreeWheel-SSP-Adapter add userIdAsEids support --- modules/freewheel-sspBidAdapter.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 1a962fd4060..02942fd7f5d 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -381,6 +381,14 @@ export const spec = { } } + if (currentBidRequest.userId && currentBidRequest.userIdAsEids) { + try { + requestParams._fw_prebid_3p_UID = JSON.stringify(currentBidRequest.userIdAsEids); + } catch (error) { + logWarn('PREBID - ' + BIDDER_CODE + ': Unable to stringify the userIdAsEids: ' + error); + } + } + var vastParams = currentBidRequest.params.vastUrlParams; if (typeof vastParams === 'object') { for (var key in vastParams) { From ace764c44a4d6c375999d0837a200cf0d08f7edd Mon Sep 17 00:00:00 2001 From: xuanwang Date: Mon, 13 Mar 2023 13:52:30 +0800 Subject: [PATCH 05/14] Freewheel-SSP-Adapter add test for eids --- modules/freewheel-sspBidAdapter.js | 2 +- .../modules/freewheel-sspBidAdapter_spec.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 02942fd7f5d..2894f414871 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -381,7 +381,7 @@ export const spec = { } } - if (currentBidRequest.userId && currentBidRequest.userIdAsEids) { + if (currentBidRequest.userIdAsEids && currentBidRequest.userIdAsEids.length > 0) { try { requestParams._fw_prebid_3p_UID = JSON.stringify(currentBidRequest.userIdAsEids); } catch (error) { diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 4d0c87ace3a..cd406afa5d8 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -1,6 +1,7 @@ import { expect } from 'chai'; import { spec } from 'modules/freewheel-sspBidAdapter.js'; import { newBidder } from 'src/adapters/bidderFactory.js'; +import { createEidsArray } from 'modules/userId/eids.js'; const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php'; @@ -131,6 +132,22 @@ describe('freewheelSSP BidAdapter Test', () => { expect(payload._fw_bidfloorcur).to.deep.equal('USD'); }); + it('should pass 3rd party IDs with the request when present', function () { + const bidRequest = bidRequests[0]; + bidRequest.userIdAsEids = createEidsArray({ + tdid: 'TTD_ID_FROM_USER_ID_MODULE', + admixerId: 'admixerId_FROM_USER_ID_MODULE', + adtelligentId: 'adtelligentId_FROM_USER_ID_MODULE' + }); + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload._fw_prebid_3p_UID).to.deep.equal(JSON.stringify([ + {source: 'adserver.org', uids: [{id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: {rtiPartner: 'TDID'}}]}, + {source: 'admixer.net', uids: [{id: 'admixerId_FROM_USER_ID_MODULE', atype: 3}]}, + {source: 'adtelligent.com', uids: [{id: 'adtelligentId_FROM_USER_ID_MODULE', atype: 3}]}, + ])); + }); + it('should return empty bidFloorCurrency when bidfloor <= 0', () => { const bidRequest = bidRequests[0]; bidRequest.getFloor = () => ({ currency: 'USD', floor: -1 }); From e5acc307760570089fa71599a2b5f758ffba271f Mon Sep 17 00:00:00 2001 From: xuanwang Date: Wed, 15 Mar 2023 13:51:29 +0800 Subject: [PATCH 06/14] Freewheel SSP Adapter: add prebid version in request --- modules/freewheel-sspBidAdapter.js | 3 +++ test/spec/modules/freewheel-sspBidAdapter_spec.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 2894f414871..94bc98b9cf3 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -350,9 +350,12 @@ export const spec = { timestamp: timeInMillis, _fw_bidfloor: (bidfloor > 0) ? bidfloor : 0, _fw_bidfloorcur: (bidfloor > 0) ? getFloorCurrency(config) : '', + pbjs_version: '$prebid.version$', pKey: keyCode }; + logWarn('wx test pbjs_version = ' + requestParams.pbjs_version); + // Add GDPR flag and consent string if (bidderRequest && bidderRequest.gdprConsent) { requestParams._fw_gdpr_consent = bidderRequest.gdprConsent.consentString; diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index cd406afa5d8..fe07dc1e719 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -4,6 +4,7 @@ import { newBidder } from 'src/adapters/bidderFactory.js'; import { createEidsArray } from 'modules/userId/eids.js'; const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php'; +const PREBID_VERSION = '$prebid.version$'; describe('freewheelSSP BidAdapter Test', () => { const adapter = newBidder(spec); @@ -166,6 +167,7 @@ describe('freewheelSSP BidAdapter Test', () => { expect(payload.componentId).to.equal('prebid'); expect(payload.componentSubId).to.equal('mustang'); expect(payload.playerSize).to.equal('300x600'); + expect(payload.pbjs_version).to.equal(PREBID_VERSION); }); it('should return a properly formatted request with schain defined', function () { From 06cb18462235a17692f0cac361a1c6b08d913456 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Wed, 15 Mar 2023 13:53:31 +0800 Subject: [PATCH 07/14] code cleanup --- modules/freewheel-sspBidAdapter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 94bc98b9cf3..c5fb813540e 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -354,8 +354,6 @@ export const spec = { pKey: keyCode }; - logWarn('wx test pbjs_version = ' + requestParams.pbjs_version); - // Add GDPR flag and consent string if (bidderRequest && bidderRequest.gdprConsent) { requestParams._fw_gdpr_consent = bidderRequest.gdprConsent.consentString; From 117010cdf3b66dfd55b27d63b7491fb5e8ee84a5 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Tue, 11 Apr 2023 16:19:45 +0800 Subject: [PATCH 08/14] FreeWheel SSP Bid Adapter: support video context and placement --- modules/freewheel-sspBidAdapter.js | 8 ++++ .../modules/freewheel-sspBidAdapter_spec.js | 37 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index c5fb813540e..8f5af48d16b 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -424,6 +424,14 @@ export const spec = { requestParams.playerSize = playerSize[0] + 'x' + playerSize[1]; } + // Add video context and placement in requestParams + if (currentBidRequest.mediaTypes.video) { + var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : 'instream'; + var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : 1; + requestParams.video_context = videoContext; + requestParams.video_placement = videoPlacement; + } + return { method: 'GET', url: FREEWHEEL_ADSSETUP, diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index fe07dc1e719..5ef03cadf6b 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -252,6 +252,13 @@ describe('freewheelSSP BidAdapter Test', () => { } ]; + it('should return context and placement with default values', () => { + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload.video_context).to.equal('instream'); ; + expect(payload.video_placement).to.equal(1); + }); + it('should add parameters to the tag', () => { const request = spec.buildRequests(bidRequests); const payload = request[0].data; @@ -319,6 +326,36 @@ describe('freewheelSSP BidAdapter Test', () => { }); }) + describe('buildRequestsForVideo', () => { + let bidRequests = [ + { + 'bidder': 'freewheel-ssp', + 'params': { + 'zoneId': '277225' + }, + 'adUnitCode': 'adunit-code', + 'mediaTypes': { + 'video': { + 'context': 'outstream', + 'placement': 2, + 'playerSize': [300, 600], + } + }, + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + } + ]; + + it('should return input context and placement', () => { + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload.video_context).to.equal('outstream'); ; + expect(payload.video_placement).to.equal(2); + }); + }) + describe('interpretResponseForBanner', () => { let bidRequests = [ { From 8acdef517e37026438862eea0dbba65e66ea688f Mon Sep 17 00:00:00 2001 From: xuanwang Date: Tue, 11 Apr 2023 16:21:50 +0800 Subject: [PATCH 09/14] update test --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 5ef03cadf6b..123981825dc 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -326,7 +326,7 @@ describe('freewheelSSP BidAdapter Test', () => { }); }) - describe('buildRequestsForVideo', () => { + describe('buildRequestsForVideoWithContextAndPlacement', () => { let bidRequests = [ { 'bidder': 'freewheel-ssp', From 6704e0033ab33c93564bf6e259f993fdb327ce18 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Thu, 27 Apr 2023 16:44:16 +0800 Subject: [PATCH 10/14] FreeWheel SSP Bid Adapter: add GPP support --- modules/freewheel-sspBidAdapter.js | 39 +++++++++++++++---- .../modules/freewheel-sspBidAdapter_spec.js | 33 +++++++++++++++- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 8f5af48d16b..c0524ca3cd6 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -1,4 +1,4 @@ -import { logWarn, isArray, isFn, deepAccess } from '../src/utils.js'; +import { logWarn, isArray, isFn, deepAccess, formatQS } from '../src/utils.js'; import { BANNER, VIDEO } from '../src/mediaTypes.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; import { config } from '../src/config.js'; @@ -372,6 +372,15 @@ export const spec = { requestParams._fw_us_privacy = bidderRequest.uspConsent; } + // Add GPP consent + if (bidderRequest && bidderRequest.gppConsent) { + requestParams.gpp = bidderRequest.gppConsent.gppString; + requestParams.gpp_sid = bidderRequest.gppConsent.applicableSections; + } else if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.regs && bidderRequest.ortb2.regs.gpp) { + requestParams.gpp = bidderRequest.ortb2.regs.gpp; + requestParams.gpp_sid = bidderRequest.ortb2.regs.gpp_sid; + } + // Add schain object var schain = currentBidRequest.schain; if (schain) { @@ -526,26 +535,42 @@ export const spec = { return bidResponses; }, - getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy) { - var gdprParams = ''; + getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy, gppConsent) { + const params = {}; + if (gdprConsent) { if (typeof gdprConsent.gdprApplies === 'boolean') { - gdprParams = `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`; + params.gdpr = Number(gdprConsent.gdprApplies); + params.gdpr_consent = gdprConsent.consentString; } else { - gdprParams = `?gdpr_consent=${gdprConsent.consentString}`; + params.gdpr_consent = gdprConsent.consentString; } } + if (gppConsent) { + if (typeof gppConsent.gppString === 'string') { + params.gpp = gppConsent.gppString; + } + if (gppConsent.applicableSections) { + params.gpp_sid = gppConsent.applicableSections; + } + } + + var queryString = ''; + if (params) { + queryString = '?' + `${formatQS(params)}`; + } + const syncs = []; if (syncOptions && syncOptions.pixelEnabled) { syncs.push({ type: 'image', - url: USER_SYNC_URL + gdprParams + url: USER_SYNC_URL + queryString }); } else if (syncOptions.iframeEnabled) { syncs.push({ type: 'iframe', - url: USER_SYNC_URL + gdprParams + url: USER_SYNC_URL + queryString }); } diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 123981825dc..21c1cc333bf 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -224,12 +224,41 @@ describe('freewheelSSP BidAdapter Test', () => { let syncOptions = { 'pixelEnabled': true } - const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null); + const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null); expect(userSyncs).to.deep.equal([{ type: 'image', url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-' }]); }); + + it('should add gpp information to the request via bidderRequest.gppConsent', function () { + let consentString = 'abc1234'; + let bidderRequest = { + 'gppConsent': { + 'gppString': consentString, + 'applicableSections': [8] + } + }; + + const request = spec.buildRequests(bidRequests, bidderRequest); + const payload = request[0].data; + + expect(payload.gpp).to.equal(consentString); + expect(payload.gpp_sid).to.deep.equal([8]); + + let gppConsent = { + 'applicableSections': [8], + 'gppString': consentString + } + let syncOptions = { + 'pixelEnabled': true + } + const userSyncs = spec.getUserSyncs(syncOptions, null, null, null, gppConsent); + expect(userSyncs).to.deep.equal([{ + type: 'image', + url: 'https://ads.stickyadstv.com/auto-user-sync?gpp=abc1234&gpp_sid=[8]' + }]); + }); }) describe('buildRequestsForVideo', () => { @@ -318,7 +347,7 @@ describe('freewheelSSP BidAdapter Test', () => { let syncOptions = { 'pixelEnabled': true } - const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null); + const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null); expect(userSyncs).to.deep.equal([{ type: 'image', url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-' From abb0a980e3131dc70a3cb63f672a1a447d8010fa Mon Sep 17 00:00:00 2001 From: xuanwang Date: Thu, 27 Apr 2023 17:10:22 +0800 Subject: [PATCH 11/14] Freewheel SSP Bid Adapter: test update --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 21c1cc333bf..d8dc6b18b8f 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -256,7 +256,7 @@ describe('freewheelSSP BidAdapter Test', () => { const userSyncs = spec.getUserSyncs(syncOptions, null, null, null, gppConsent); expect(userSyncs).to.deep.equal([{ type: 'image', - url: 'https://ads.stickyadstv.com/auto-user-sync?gpp=abc1234&gpp_sid=[8]' + url: 'https://ads.stickyadstv.com/auto-user-sync?gpp=abc1234&gpp_sid[]=8' }]); }); }) From 5a956e69416192c75e855acface1770ce5f571d0 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Fri, 19 May 2023 16:51:53 +0800 Subject: [PATCH 12/14] FreeWheel SSP Adapter: update the default value for video placement and context --- modules/freewheel-sspBidAdapter.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index c0524ca3cd6..6ed744b719b 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -340,6 +340,7 @@ export const spec = { var timeInMillis = new Date().getTime(); var keyCode = hashcode(zone + '' + timeInMillis); var bidfloor = getBidFloor(currentBidRequest, config); + var format = currentBidRequest.params.format; var requestParams = { reqType: 'AdsSetup', @@ -435,8 +436,12 @@ export const spec = { // Add video context and placement in requestParams if (currentBidRequest.mediaTypes.video) { - var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : 'instream'; - var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : 1; + var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : ''; + var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : null; + if (format == 'inbanner') { + videoPlacement = 2; + videoContext = 'In-Banner'; + } requestParams.video_context = videoContext; requestParams.video_placement = videoPlacement; } From 5be14a73aafb99a3ec376d83f4495a3754096f1e Mon Sep 17 00:00:00 2001 From: xuanwang Date: Fri, 19 May 2023 17:20:44 +0800 Subject: [PATCH 13/14] update test --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index d8dc6b18b8f..6b3e21cb121 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -284,8 +284,8 @@ describe('freewheelSSP BidAdapter Test', () => { it('should return context and placement with default values', () => { const request = spec.buildRequests(bidRequests); const payload = request[0].data; - expect(payload.video_context).to.equal('instream'); ; - expect(payload.video_placement).to.equal(1); + expect(payload.video_context).to.equal(''); ; + expect(payload.video_placement).to.equal(null); }); it('should add parameters to the tag', () => { From 30af5a4ca7ba451e89d5a7c08e8f4c61e0c5c572 Mon Sep 17 00:00:00 2001 From: xuanwang Date: Mon, 22 May 2023 11:52:30 +0800 Subject: [PATCH 14/14] FreeWheel SSP Adapter: add support for video.plcmt --- modules/freewheel-sspBidAdapter.js | 3 +++ test/spec/modules/freewheel-sspBidAdapter_spec.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 6ed744b719b..cd4785cdc78 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -438,12 +438,15 @@ export const spec = { if (currentBidRequest.mediaTypes.video) { var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : ''; var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : null; + var videoPlcmt = currentBidRequest.mediaTypes.video.plcmt ? currentBidRequest.mediaTypes.video.plcmt : null; + if (format == 'inbanner') { videoPlacement = 2; videoContext = 'In-Banner'; } requestParams.video_context = videoContext; requestParams.video_placement = videoPlacement; + requestParams.video_plcmt = videoPlcmt; } return { diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 6b3e21cb121..fe04a430ce6 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -286,6 +286,7 @@ describe('freewheelSSP BidAdapter Test', () => { const payload = request[0].data; expect(payload.video_context).to.equal(''); ; expect(payload.video_placement).to.equal(null); + expect(payload.video_plcmt).to.equal(null); }); it('should add parameters to the tag', () => { @@ -367,6 +368,7 @@ describe('freewheelSSP BidAdapter Test', () => { 'video': { 'context': 'outstream', 'placement': 2, + 'plcmt': 3, 'playerSize': [300, 600], } }, @@ -382,6 +384,7 @@ describe('freewheelSSP BidAdapter Test', () => { const payload = request[0].data; expect(payload.video_context).to.equal('outstream'); ; expect(payload.video_placement).to.equal(2); + expect(payload.video_plcmt).to.equal(3); }); })