Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invibes Bid Adapter - support for adUnitCode differentiation in multiposition #7652

Merged
merged 37 commits into from
Nov 12, 2021
Merged
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3ad6bf0
Invibes Bid Adapter - support for adUnitCode differentiation in multi…
rcheptanariu Nov 2, 2021
e60844e
TheMediaGrid Bid Adapter: added adlivetech as alias (#7649)
TheMediaGrid Nov 2, 2021
c76dc38
move targets to packag.json (#7641)
ChrisHuie Nov 2, 2021
62ea19f
TrustX Bid Adapter: added support of PBAdSlot module (#7653)
PWyrembak Nov 2, 2021
906e8c4
OpenX Bid adapter: Handle new user Ids (#7642)
luigi-sayson Nov 2, 2021
c533fb6
Saamba Bid Adapter: support video params, and the floors module (#7448)
NeerajKrRai Nov 3, 2021
5960369
IX Bid Adapter: capture errors in LS and send errors in request (#7630)
umakajan Nov 3, 2021
832c13e
Deepintent: secure flag set using proper protocol value (#7655)
parthshah51999 Nov 3, 2021
2dbe76f
VIS.X: fix url for timeout pixel (#7657)
mk0x9 Nov 3, 2021
bf48688
appnexus bid adapter - add support for brandId (#7658)
jsnellbaker Nov 3, 2021
afc06fc
Invibes Bid Adapter - redo tests
rcheptanariu Nov 8, 2021
564dcbe
Engageya bid adapter improvements (#7656)
mikomgk Nov 8, 2021
e861406
Eplanning & Adapter Manager: fix testing of innerwidth to fix current…
robertrmartinez Nov 8, 2021
539d1b4
Smaato: Pass through bidRequest.schain (#7675)
el-chuck Nov 8, 2021
6539e76
expose seedtag gvl id for TFC2 support (#7674)
ybootin Nov 8, 2021
5ad61fc
docs only: remove reference to release notes page and some documentat…
smenzer Nov 8, 2021
4253497
Capture target demand provider (#7636)
samueldobbie Nov 9, 2021
22e02f4
Invibes Bid Adapter - added unit tests for adUnitCode logic
rcheptanariu Nov 9, 2021
7775abb
Invibes Bid Adapter - fixed lint
rcheptanariu Nov 9, 2021
3e343ed
Datablocks Bid Adapter: update url (#7680)
jmayor Nov 9, 2021
89f61a7
Datablocks Tests: fix failing tests (#7687)
ChrisHuie Nov 9, 2021
6b027f5
RichAudience Bid Adapter: Update GetFloors (#7664)
richaudience Nov 9, 2021
39b26b3
Adhese Bid Adapter: Configurable vast as url (#7659)
mefjush Nov 9, 2021
1463ed9
add bidderDefaultFunction (#7628)
eknis Nov 9, 2021
fc9caa2
IX Bid Adapter: add support for handling vastXML responses in PBJS (#…
shahinrahbariasl Nov 10, 2021
701eebc
PubMatic Bid Adapter: add Groupm as alias bidder (#7692)
pm-azhar-mulla Nov 10, 2021
bd6f395
GPT Pre Auction: setting GPID (#7671)
robertrmartinez Nov 10, 2021
8163a23
Do not lint node_modules (#7689)
dgirardi Nov 10, 2021
4809a4e
send all custom params to the bidder (#7685)
antoinezaz Nov 10, 2021
b289d73
Revert "RichAudience Bid Adapter: Update GetFloors (#7664)" (#7695)
ChrisHuie Nov 10, 2021
379519b
Prebid 6.1.0 Release
jsnellbaker Nov 10, 2021
2e2fdd8
increment pre version
jsnellbaker Nov 10, 2021
e1e434f
Invibes Bid Adapter - support for adUnitCode differentiation in multi…
rcheptanariu Nov 2, 2021
eb71073
Invibes Bid Adapter - redo tests
rcheptanariu Nov 8, 2021
41e843a
Invibes Bid Adapter - added unit tests for adUnitCode logic
rcheptanariu Nov 9, 2021
35ec312
Invibes Bid Adapter - fixed lint
rcheptanariu Nov 9, 2021
b633982
Merge branch 'master' of github.com:rcheptanariu/Prebid.js
rcheptanariu Nov 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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