From 2e00b2199938a25fa3af6ddabef1dcef12106234 Mon Sep 17 00:00:00 2001 From: rcheptanariu <35690143+rcheptanariu@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:16:52 +0200 Subject: [PATCH] Invibes Bid Adapter - support for adUnitCode differentiation in multiposition (#7652) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Invibes Bid Adapter - support for adUnitCode differentiation in multiposition when same placement is used * TheMediaGrid Bid Adapter: added adlivetech as alias (#7649) * Added TheMediaGridNM Bid Adapter * Updated required params for TheMediaGridNM Bid Adapter * Update TheMediGridNM Bid Adapter * Fix tests for TheMediaGridNM Bid Adapter * Fixes after review for TheMediaGridNM Bid Adapter * Add support of multi-format in TheMediaGrid Bid Adapter * Update sync url for grid and gridNM Bid Adapters * TheMediaGrid Bid Adapter: added keywords adUnit parameter * Update TheMediaGrid Bid Adapter to support keywords from config * Implement new request format for TheMediaGrid Bid Adapter * Fix jwpseg params for TheMediaGrid Bid Adapter * Update unit tests for The Media Grid Bid Adapter * Fix typo in TheMediaGrid Bid Adapter * Added test for jwTargeting in TheMediaGrid Bid Adapter * The new request format was made by default in TheMediaGrid Bid Adapter * Update userId format in ad request for TheMediaGrid Bid Adapter * Added bidFloor parameter for TheMediaGrid Bid Adapter * Fix for review TheMediaGrid Bid Adapter * Support floorModule in TheMediaGrid Bid Adapter * Fix empty bidfloor for TheMediaGrid Bid Adapter * Some change to restart autotests * Fix userIds format for TheMediaGrid Bid Adapter * Remove digitrust userId from TheMediaGrid Bid Adapter * Protocols was added in video section in ad request for TheMediaGrid Bid Adapter * TheMediaGrid: fix trouble with alias using * TheMediaGridNM: fix trouble with alias * TheMediaGrid Bid Adapter: added support of PBAdSlot module * TheMediaGrid Bid Adapter: fix typo * GridNM Bid Adapter: use absent in params data from mediaTypes * GridNM Bid Adapter: fix md file + add advertiserDomains support * TheMediaGrid and gridNM Bid Adapter: minor netRevenue fixes * gridNM Bid Adapter updates after review * TheMediaGrid Bid Adapter: fix keywords workflow * fix testing and kick off lgtm again * TheMediaGrid: added ext.bidder.grid.demandSource processing * TheMediaGrid: added user.id from fpd cookie * TheMediaGrid: control cookie setting via bidder config * TheMediaGrid: use localStorage instead cookie * TheMediaGridNM Bid Adapter: update adapter to use /hbjson endpoint * TheMediaGridNM: fix unnecessary conditions * TheMediaGrid: fix bug with nurl field in response * TheMediaGrid: update test * TheMediaGridNM: fix possible bug with nurl * TheMediaGrid: added alias as playwire * TheMediaGrid: added alias as adlivetech Co-authored-by: Chris Huie * move targets to packag.json (#7641) * TrustX Bid Adapter: added support of PBAdSlot module (#7653) * Add trustx adapter and tests for it * update integration example * Update trustx adapter * Post-review fixes of Trustx adapter * Code improvement for trustx adapter: changed default price type from gross to net * Update TrustX adapter to support the 1.0 version * Make requested changes for TrustX adapter * Updated markdown file for TrustX adapter * Fix TrustX adapter and spec file * Update TrustX adapter: r parameter was added to ad request as cache buster * Add support of gdpr to Trustx Bid Adapter * Add wtimeout to ad request params for TrustX Bid Adapter * TrustX Bid Adapter: remove last ampersand in the ad request * Update TrustX Bid Adapter to support identical uids in parameters * Update TrustX Bid Adapter to ignore bids that sizes do not match the size of the request * Update TrustX Bid Adapter to support instream and outstream video * Added wrapperType and wrapperVersion parameters in ad request for TrustX Bid Adapter * Update TrustX Bid Adapter to use refererInfo instead depricated function utils.getTopWindowUrl * HOTFIX for referrer encodind in TrustX Bid Adapter * Fix test for TrustX Bid Adapter * TrustX Bid Adapter: added keywords passing support * TrustX Bid Adapter: added us_privacy parameter in bid request * TrustX Bid Adapter: fix us_privacy parameter in bid request * Fix alias error for TrustX Bid Adapter * TrustX Bid Adapter: added new request format * TrustX Bid adapter: fix new format endpoint * TrustX Bid Adapter: update md file to support useNewFormat parameter * TrustX Bid Adapter: added additional sync url * TrustX Bid Adapter: added check for enabled syncs number + added gdpr data to sync urls * TrustX Bid Adapter: added support of meta.advertiserDomains * TrustX Bid Adapter: added support rtd permutive and jwplayer for new and old request format * TrustX Bid Adapter: Use new format by default + new keywords logic * TrustX Bid Adapter: fix md file * TrustX: Convert all id-like request fields to a string * TrustX: added vastUrl support * TrustX: fix segments format * TrustX: added support of PBAdSlot module * OpenX Bid adapter: Handle new user Ids (#7642) * Saamba Bid Adapter: support video params, and the floors module (#7448) * Submit Advangelists Prebid Adapter * Submit Advangelists Prebid Adapter 1.1 * Submit Advangelists Prebid Adapter Changes * Update Bidder Code To make adapter downloadable from git biddercode change is needed. * Changes to Support Prebid 5.0. https://github.com/prebid/Prebid.js/issues/6650 supporting advertiserDomains https://github.com/prebid/Prebid.js/issues/6512 Support video params at the adunit level https://github.com/prebid/Prebid.js/issues/6465 * Delete advangelistsBidAdapter.js.bak * Delete advangelistsBidAdapter.md.bak * Delete advangelistsBidAdapter_spec.js.bak * Update advangelistsBidAdapter.js * Add files via upload * Update advangelistsBidAdapter.js * Update advangelistsBidAdapter.js * Update advangelistsBidAdapter.js * Delete url.js * Add files via upload * Update advangelistsBidAdapter.js * Update saambaaBidAdapter.js * Update saambaaBidAdapter.js * Update saambaaBidAdapter.js * Update saambaaBidAdapter.js * Update saambaaBidAdapter.js Co-authored-by: Chandra Prakash * IX Bid Adapter: capture errors in LS and send errors in request (#7630) * capture errors in LS and send errors in request * fix linting * Deepintent: secure flag set using proper protocol value (#7655) * VIS.X: fix url for timeout pixel (#7657) * appnexus bid adapter - add support for brandId (#7658) * Invibes Bid Adapter - redo tests * Engageya bid adapter improvements (#7656) * Validate image size * Support net revenue * Add widget view pixel * Eplanning & Adapter Manager: fix testing of innerwidth to fix current build (#7679) * console log innerWidth * hmmm * more debug * weird * if I change to larger mediaQuery it works I think * stub window.top becasue we are mocking just window * stub similar to sizeConfig test * addressing window things * i camel cased * stub stuff right * remove debug logs * Smaato: Pass through bidRequest.schain (#7675) Co-authored-by: Bernhard Pickenbrock * expose seedtag gvl id for TFC2 support (#7674) * docs only: remove reference to release notes page and some documentation links (#7672) * Capture target demand provider (#7636) - Use the provided storage manager - Capture target demand provider & account id - Add flag to trigger randomly-generated demo bid response * Invibes Bid Adapter - added unit tests for adUnitCode logic * Invibes Bid Adapter - fixed lint * Datablocks Bid Adapter: update url (#7680) * updated url * update metrics url Co-authored-by: John Mayor * Datablocks Tests: fix failing tests (#7687) * Datablocks Tests: fix failing tests * take out source * RichAudience Bid Adapter: Update GetFloors (#7664) * Update GetFloors * Update Strings must use singlequote * Update push * Update remove space * Push Test * Push Test 2 * New Attempt * New Attempt 2 * New Attempt 3 * New Attempt 5 Co-authored-by: sgimenez * Adhese Bid Adapter: Configurable vast as url (#7659) * adpod category support test * Revert "adpod category support test" This reverts commit 70a3cf2ad5db94757addd9e08c3a083caca282d0. * adpod category support test * Revert "adpod category support test" This reverts commit 70a3cf2ad5db94757addd9e08c3a083caca282d0. * Adhese bid adapter: make the vastContentAsUrl setting configurable Co-authored-by: Tim Sturtewagen Co-authored-by: Paweł L Co-authored-by: westerschmal <30859973+westerschmal@users.noreply.github.com> * add bidderDefaultFunction (#7628) * IX Bid Adapter: add support for handling vastXML responses in PBJS (#7661) * Add Index Exchange Video Adapter * add support for handling vastXML responses in PBJS * Remove Video Adapter code Co-authored-by: Michael Harris Co-authored-by: Arven Ding Co-authored-by: IX Prebid Support Co-authored-by: Michael Burns Co-authored-by: shahin.rahbariasl Co-authored-by: Kajan Umakanthan * PubMatic Bid Adapter: add Groupm as alias bidder (#7692) * Changed net revenue to True * Added groupm as alias in pubmaticBidAdapter * Added gvlid for groupm alias * add space for linting Co-authored-by: Azhar Co-authored-by: Chris Huie * GPT Pre Auction: setting GPID (#7671) * set gpid * fix gptPreAuction tests * clean logic + add test * Do not lint node_modules (#7689) Running npm ci with npm 8.x installs dependencies in plugins/eslint/node_modules, which chokes the linter. * send all custom params to the bidder (#7685) * Revert "RichAudience Bid Adapter: Update GetFloors (#7664)" (#7695) This reverts commit 6b027f5d960b6d37b9d6fd90d558494b390085a3. * Prebid 6.1.0 Release * increment pre version * Invibes Bid Adapter - support for adUnitCode differentiation in multiposition when same placement is used * Invibes Bid Adapter - redo tests * Invibes Bid Adapter - added unit tests for adUnitCode logic * Invibes Bid Adapter - fixed lint Co-authored-by: TheMediaGrid <44166371+TheMediaGrid@users.noreply.github.com> Co-authored-by: Chris Huie Co-authored-by: PWyrembak Co-authored-by: Luigi Sayson <48766825+luigi-sayson@users.noreply.github.com> Co-authored-by: NeerajKrRai <55957265+NeerajKrRai@users.noreply.github.com> Co-authored-by: Chandra Prakash Co-authored-by: Kajan Umakanthan Co-authored-by: Parth Shah Co-authored-by: Michael Kuryshev Co-authored-by: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Co-authored-by: Miko Stern <37616476+mikomgk@users.noreply.github.com> Co-authored-by: Robert Ray Martinez III Co-authored-by: el-chuck Co-authored-by: Bernhard Pickenbrock Co-authored-by: Yohan Boutin Co-authored-by: Scott Menzer Co-authored-by: Samuel Dobbie Co-authored-by: jmayor Co-authored-by: John Mayor Co-authored-by: Rich Audience Co-authored-by: sgimenez Co-authored-by: mefjush Co-authored-by: Tim Sturtewagen Co-authored-by: Paweł L Co-authored-by: westerschmal <30859973+westerschmal@users.noreply.github.com> Co-authored-by: eknis Co-authored-by: shahinrahbariasl <56240400+shahinrahbariasl@users.noreply.github.com> Co-authored-by: Michael Harris Co-authored-by: Arven Ding Co-authored-by: IX Prebid Support Co-authored-by: Michael Burns Co-authored-by: shahin.rahbariasl Co-authored-by: pm-azhar-mulla <75726247+pm-azhar-mulla@users.noreply.github.com> Co-authored-by: Azhar Co-authored-by: dgirardi Co-authored-by: antoinezaz Co-authored-by: Jason Snellbaker --- modules/invibesBidAdapter.js | 24 +++++++++------ test/spec/modules/invibesBidAdapter_spec.js | 33 ++++++++++++++++++--- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/modules/invibesBidAdapter.js b/modules/invibesBidAdapter.js index 75da1509f19..d715ecf6663 100644 --- a/modules/invibesBidAdapter.js +++ b/modules/invibesBidAdapter.js @@ -77,12 +77,14 @@ function isBidRequestValid(bid) { function buildRequest(bidRequests, bidderRequest) { bidderRequest = bidderRequest || {}; const _placementIds = []; + const _adUnitCodes = []; let _loginId, _customEndpoint, _userId; let _ivAuctionStart = bidderRequest.auctionStart || Date.now(); bidRequests.forEach(function (bidRequest) { bidRequest.startTime = new Date().getTime(); _placementIds.push(bidRequest.params.placementId); + _adUnitCodes.push(bidRequest.adUnitCode); _loginId = _loginId || bidRequest.params.loginId; _customEndpoint = _customEndpoint || bidRequest.params.customEndpoint; _customUserSync = _customUserSync || bidRequest.params.customUserSync; @@ -99,6 +101,7 @@ function buildRequest(bidRequests, bidderRequest) { let userIdModel = getUserIds(_userId); let bidParamsJson = { placementIds: _placementIds, + adUnitCodes: _adUnitCodes, loginId: _loginId, auctionStartTime: _ivAuctionStart, bidVersion: CONSTANTS.PREBID_VERSION @@ -181,9 +184,12 @@ function handleResponse(responseObj, bidRequests) { const bidResponses = []; for (let i = 0; i < bidRequests.length; i++) { let bidRequest = bidRequests[i]; + let usedPlacementId = responseObj.UseAdUnitCode === true + ? bidRequest.params.placementId + '_' + bidRequest.adUnitCode + : bidRequest.params.placementId; - if (invibes.placementBids.indexOf(bidRequest.params.placementId) > -1) { - logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId); + if (invibes.placementBids.indexOf(usedPlacementId) > -1) { + logInfo('Invibes Adapter - Placement was previously bid on ' + usedPlacementId); continue; } @@ -191,21 +197,21 @@ function handleResponse(responseObj, bidRequests) { if (responseObj.AdPlacements != null) { for (let j = 0; j < responseObj.AdPlacements.length; j++) { let bidModel = responseObj.AdPlacements[j].BidModel; - if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) { + if (bidModel != null && bidModel.PlacementId == usedPlacementId) { requestPlacement = responseObj.AdPlacements[j]; break; } } } else { let bidModel = responseObj.BidModel; - if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) { + if (bidModel != null && bidModel.PlacementId == usedPlacementId) { requestPlacement = responseObj; } } - let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled); + let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled, usedPlacementId); if (bid !== null) { - invibes.placementBids.push(bidRequest.params.placementId); + invibes.placementBids.push(usedPlacementId); bidResponses.push(bid); } } @@ -213,9 +219,9 @@ function handleResponse(responseObj, bidRequests) { return bidResponses; } -function createBid(bidRequest, requestPlacement, multipositionEnabled) { +function createBid(bidRequest, requestPlacement, multipositionEnabled, usedPlacementId) { if (requestPlacement === null || requestPlacement.BidModel === null) { - logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId); + logInfo('Invibes Adapter - Placement not configured for bidding ' + usedPlacementId); return null; } @@ -684,7 +690,7 @@ let keywords = (function () { return kw; }()); -// ===================== +// ====================== export function resetInvibes() { invibes.optIn = undefined; diff --git a/test/spec/modules/invibesBidAdapter_spec.js b/test/spec/modules/invibesBidAdapter_spec.js index 8b92e0ee81b..a61c4fa5267 100644 --- a/test/spec/modules/invibesBidAdapter_spec.js +++ b/test/spec/modules/invibesBidAdapter_spec.js @@ -15,7 +15,7 @@ describe('invibesBidAdapter:', function () { params: { placementId: PLACEMENT_ID }, - adUnitCode: 'test-div', + adUnitCode: 'test-div1', auctionId: 'a1', sizes: [ [300, 250], @@ -30,7 +30,7 @@ describe('invibesBidAdapter:', function () { params: { placementId: 'abcde' }, - adUnitCode: 'test-div', + adUnitCode: 'test-div2', auctionId: 'a2', sizes: [ [300, 250], @@ -48,7 +48,7 @@ describe('invibesBidAdapter:', function () { params: { placementId: PLACEMENT_ID }, - adUnitCode: 'test-div', + adUnitCode: 'test-div1', auctionId: 'a1', sizes: [ [300, 250], @@ -67,7 +67,7 @@ describe('invibesBidAdapter:', function () { params: { placementId: 'abcde' }, - adUnitCode: 'test-div', + adUnitCode: 'test-div2', auctionId: 'a2', sizes: [ [300, 250], @@ -223,6 +223,12 @@ describe('invibesBidAdapter:', function () { expect(JSON.parse(request.data.bidParamsJson).placementIds).to.contain(bidRequests[1].params.placementId); }); + it('sends all adUnitCodes', function () { + const request = spec.buildRequests(bidRequests); + expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[0].adUnitCode); + expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[1].adUnitCode); + }); + it('sends all Placement Ids and userId', function () { const request = spec.buildRequests(bidRequestsWithUserId); expect(JSON.parse(request.data.bidParamsJson).userId).to.exist; @@ -823,6 +829,20 @@ describe('invibesBidAdapter:', function () { } }; + let responseWithAdUnit = { + Ads: [{ + BidPrice: 0.5, + VideoExposedId: 123 + }], + BidModel: { + BidVersion: 1, + PlacementId: '12345_test-div1', + AuctionStartTime: Date.now(), + CreativeHtml: '' + }, + UseAdUnitCode: true + }; + var buildResponse = function(placementId, cid, blcids, creativeId) { return { MultipositionEnabled: true, @@ -911,6 +931,11 @@ describe('invibesBidAdapter:', function () { let secondResult = spec.interpretResponse({body: response}, {bidRequests}); expect(secondResult).to.be.empty; }); + + it('bids using the adUnitCode', function () { + let result = spec.interpretResponse({body: responseWithAdUnit}, {bidRequests}); + expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); + }); }); context('when the response has meta', function () {