Skip to content

Commit

Permalink
Invibes Bid Adapter - support for adUnitCode differentiation in multi…
Browse files Browse the repository at this point in the history
…position (#7652)

* 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 <phoenixtechnerd@gmail.com>

* 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.

#6650
supporting advertiserDomains

#6512
Support video params at the adunit level

#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 <chandra.prakash@advangelists.com>

* 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 <bernhard.pickenbrock@smaato.com>

* 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 <john@Johns-iMac.local>

* 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 <sergi.gimenez@richaudience.com>

* Adhese Bid Adapter: Configurable vast as url (#7659)

* adpod category support test

* Revert "adpod category support test"

This reverts commit 70a3cf2.

* adpod category support test

* Revert "adpod category support test"

This reverts commit 70a3cf2.

* Adhese bid adapter: make the vastContentAsUrl setting configurable

Co-authored-by: Tim Sturtewagen <tim@adhese.com>
Co-authored-by: Paweł L <pawel.lankocz@adhese.eu>
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 <michael.harris@indexexchange.com>
Co-authored-by: Arven Ding <arven.ding@indexexchange.com>
Co-authored-by: IX Prebid Support <prebid.support@indexexchange.com>
Co-authored-by: Michael Burns <mlb7687@users.noreply.github.com>
Co-authored-by: shahin.rahbariasl <shahin.rahbariasl@indexexchange.com>
Co-authored-by: Kajan Umakanthan <umakajan@umakajan.com>

* 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 <azhar@L1119.local>
Co-authored-by: Chris Huie <phoenixtechnerd@gmail.com>

* 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 6b027f5.

* 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 <phoenixtechnerd@gmail.com>
Co-authored-by: PWyrembak <paul@trustx.org>
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 <chandra.prakash@advangelists.com>
Co-authored-by: Kajan Umakanthan <umakajan@umakajan.com>
Co-authored-by: Parth Shah <parth@deepintent.com>
Co-authored-by: Michael Kuryshev <mk0x9@users.noreply.github.com>
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 <rrmartinez1552@gmail.com>
Co-authored-by: el-chuck <be.pickenbrock@gmail.com>
Co-authored-by: Bernhard Pickenbrock <bernhard.pickenbrock@smaato.com>
Co-authored-by: Yohan Boutin <yohan@seedtag.com>
Co-authored-by: Scott Menzer <scott@id5.io>
Co-authored-by: Samuel Dobbie <samueldobbie@users.noreply.github.com>
Co-authored-by: jmayor <john@johnmayor.ca>
Co-authored-by: John Mayor <john@Johns-iMac.local>
Co-authored-by: Rich Audience <integrations@richaudience.com>
Co-authored-by: sgimenez <sergi.gimenez@richaudience.com>
Co-authored-by: mefjush <mefjush@gmail.com>
Co-authored-by: Tim Sturtewagen <tim@adhese.com>
Co-authored-by: Paweł L <pawel.lankocz@adhese.eu>
Co-authored-by: westerschmal <30859973+westerschmal@users.noreply.github.com>
Co-authored-by: eknis <tem.eknis@gmail.com>
Co-authored-by: shahinrahbariasl <56240400+shahinrahbariasl@users.noreply.github.com>
Co-authored-by: Michael Harris <michael.harris@indexexchange.com>
Co-authored-by: Arven Ding <arven.ding@indexexchange.com>
Co-authored-by: IX Prebid Support <prebid.support@indexexchange.com>
Co-authored-by: Michael Burns <mlb7687@users.noreply.github.com>
Co-authored-by: shahin.rahbariasl <shahin.rahbariasl@indexexchange.com>
Co-authored-by: pm-azhar-mulla <75726247+pm-azhar-mulla@users.noreply.github.com>
Co-authored-by: Azhar <azhar@L1119.local>
Co-authored-by: dgirardi <demetrio.girardi@gmail.com>
Co-authored-by: antoinezaz <antoine.zazzera@gmail.com>
Co-authored-by: Jason Snellbaker <jsnellbaker@appnexus.com>
  • Loading branch information
1 parent 7cbfe92 commit 2e00b21
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 13 deletions.
24 changes: 15 additions & 9 deletions modules/invibesBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -181,41 +184,44 @@ 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;
}

let requestPlacement = null;
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);
}
}

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;
}

Expand Down Expand Up @@ -684,7 +690,7 @@ let keywords = (function () {
return kw;
}());

// =====================
// ======================

export function resetInvibes() {
invibes.optIn = undefined;
Expand Down
33 changes: 29 additions & 4 deletions test/spec/modules/invibesBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('invibesBidAdapter:', function () {
params: {
placementId: PLACEMENT_ID
},
adUnitCode: 'test-div',
adUnitCode: 'test-div1',
auctionId: 'a1',
sizes: [
[300, 250],
Expand All @@ -30,7 +30,7 @@ describe('invibesBidAdapter:', function () {
params: {
placementId: 'abcde'
},
adUnitCode: 'test-div',
adUnitCode: 'test-div2',
auctionId: 'a2',
sizes: [
[300, 250],
Expand All @@ -48,7 +48,7 @@ describe('invibesBidAdapter:', function () {
params: {
placementId: PLACEMENT_ID
},
adUnitCode: 'test-div',
adUnitCode: 'test-div1',
auctionId: 'a1',
sizes: [
[300, 250],
Expand All @@ -67,7 +67,7 @@ describe('invibesBidAdapter:', function () {
params: {
placementId: 'abcde'
},
adUnitCode: 'test-div',
adUnitCode: 'test-div2',
auctionId: 'a2',
sizes: [
[300, 250],
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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: '<!-- Creative -->'
},
UseAdUnitCode: true
};

var buildResponse = function(placementId, cid, blcids, creativeId) {
return {
MultipositionEnabled: true,
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 2e00b21

Please sign in to comment.