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

Orbitsoft Bid Adapter : add adapter back to current version #9288

Merged
merged 27 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
82686c9
Adding Orbitsoft module
dmitriy-shimko-nrich Jul 13, 2017
d068d59
Adding Orbitsoft module (corrected)
dmitriy-shimko-nrich Jul 13, 2017
a24ab8a
Merge branch 'master' of https://github.com/prebid/Prebid.js
dmitriy-shimko-nrich Jul 27, 2017
42f1d66
Adding Orbitsoft module (correction of remarks)
dmitriy-shimko-nrich Jul 28, 2017
aba01a3
Adding Orbitsoft module (correction of remarks)
dmitriy-shimko-nrich Jul 28, 2017
be50c55
Adding Orbitsoft module (correction to alias-able)
dmitriy-shimko-nrich Sep 14, 2017
0af08c9
Adding Orbitsoft module (correction to alias-able)
dmitriy-shimko-nrich Sep 14, 2017
ccf57ef
Adding Orbitsoft module (correction to alias-able)
dmitriy-shimko-nrich Sep 14, 2017
e492c4c
Merge branch 'master' of https://github.com/prebid/Prebid.js
dmitriy-shimko-nrich Sep 14, 2017
28d89b0
Adding Orbitsoft module (correction to alias-able)
dmitriy-shimko-nrich Sep 14, 2017
1c873a0
Adding Orbitsoft module (correction to new constructor)
dmitriy-shimko-nrich Sep 15, 2017
6337b57
Adding Orbitsoft module (delete unnecessary aliases)
dmitriy-shimko-nrich Sep 15, 2017
60aa74b
Adding Orbitsoft module (delete unnecessary aliases)
dmitriy-shimko-nrich Sep 15, 2017
249edcd
Merge branch 'prebid:master' into master
VitalyOrbit Apr 26, 2022
ad39397
fixed orbitsoftAdapter
Apr 26, 2022
4dd4f06
Merge pull request #1 from OrbitScripts/fix-orbitsoftAdaper
VitalyOrbit Apr 26, 2022
c00931a
fixed orbitsoftAdapter processing undefined request referrer
Nov 24, 2022
1f21bb9
fixed orbitsoftAdapter processing undefined request referrer
Nov 24, 2022
9639457
Merge pull request #2 from OrbitScripts/fix-orbitsoftAdapter-requestR…
VitalyOrbit Nov 24, 2022
35457cf
fix-orbitsoftAdaper: codereview fixes
Nov 29, 2022
29517f3
Merge branch 'prebid:master' into master
VitalyOrbit Nov 29, 2022
d5639eb
added changes for new spec
Nov 29, 2022
4ea06dc
Merge pull request #4 from OrbitScripts/fix-orbitsoftAdaper-newSpec
VitalyOrbit Nov 29, 2022
c6ee0e7
added changes for new spec
Nov 29, 2022
e5a3f64
Merge pull request #5 from OrbitScripts/fix-orbitsoftAdaper-newSpec
VitalyOrbit Nov 29, 2022
803ca2d
added changes for new spec
Nov 29, 2022
0f69cd3
Merge pull request #6 from OrbitScripts/fix-orbitsoftAdaper-newSpec
VitalyOrbit Nov 29, 2022
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
150 changes: 150 additions & 0 deletions modules/orbitsoftBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';

const BIDDER_CODE = 'orbitsoft';
let styleParamsMap = {
'title.family': 'f1', // headerFont
'title.size': 'fs1', // headerFontSize
'title.weight': 'w1', // headerWeight
'title.style': 's1', // headerStyle
'title.color': 'c3', // headerColor
'description.family': 'f2', // descriptionFont
'description.size': 'fs2', // descriptionFontSize
'description.weight': 'w2', // descriptionWeight
'description.style': 's2', // descriptionStyle
'description.color': 'c4', // descriptionColor
'url.family': 'f3', // urlFont
'url.size': 'fs3', // urlFontSize
'url.weight': 'w3', // urlWeight
'url.style': 's3', // urlStyle
'url.color': 'c5', // urlColor
'colors.background': 'c2', // borderColor
'colors.border': 'c1', // borderColor
'colors.link': 'c6', // lnkColor
};
export const spec = {
code: BIDDER_CODE,
aliases: ['oas', '152media'], // short code and customer aliases
isBidRequestValid: function (bid) {
switch (true) {
case !('params' in bid):
utils.logError(bid.bidder + ': No required params');
return false;
case !(bid.params.placementId):
utils.logError(bid.bidder + ': No required param placementId');
return false;
case !(bid.params.requestUrl):
utils.logError(bid.bidder + ': No required param requestUrl');
return false;
}
return true;
},
buildRequests: function (validBidRequests) {
let bidRequest;
let serverRequests = [];
for (let i = 0; i < validBidRequests.length; i++) {
bidRequest = validBidRequests[i];
let bidRequestParams = bidRequest.params;
let placementId = utils.getBidIdParameter('placementId', bidRequestParams);
let requestUrl = utils.getBidIdParameter('requestUrl', bidRequestParams);
let referrer = utils.getBidIdParameter('ref', bidRequestParams);
let location = utils.getBidIdParameter('loc', bidRequestParams);
// Append location & referrer
if (location === '') {
location = utils.getWindowLocation();
}
if (referrer === '' && bidRequest && bidRequest.refererInfo) {
referrer = bidRequest.refererInfo.referer;
}

// Styles params
let stylesParams = utils.getBidIdParameter('style', bidRequestParams);
let stylesParamsArray = {};
for (let currentValue in stylesParams) {
if (stylesParams.hasOwnProperty(currentValue)) {
let currentStyle = stylesParams[currentValue];
for (let field in currentStyle) {
if (currentStyle.hasOwnProperty(field)) {
let styleField = styleParamsMap[currentValue + '.' + field];
if (typeof styleField !== 'undefined') {
stylesParamsArray[styleField] = currentStyle[field];
}
}
}
}
}
// Custom params
let customParams = utils.getBidIdParameter('customParams', bidRequestParams);
let customParamsArray = {};
for (let customField in customParams) {
if (customParams.hasOwnProperty(customField)) {
customParamsArray['c.' + customField] = customParams[customField];
}
}

// Sizes params (not supports by server, for future features)
let sizesParams = bidRequest.sizes;
let parsedSizes = utils.parseSizesInput(sizesParams);
let requestData = Object.assign({
'scid': placementId,
'callback_uid': utils.generateUUID(),
'loc': location,
'ref': referrer,
'size': parsedSizes
}, stylesParamsArray, customParamsArray);

serverRequests.push({
method: 'POST',
url: requestUrl,
data: requestData,
options: {withCredentials: false},
bidRequest: bidRequest
});
}
return serverRequests;
},
interpretResponse: function (serverResponse, request) {
let bidResponses = [];
if (!serverResponse || serverResponse.error) {
utils.logError(BIDDER_CODE + ': Server response error');
return bidResponses;
}

const serverBody = serverResponse.body;
if (!serverBody) {
utils.logError(BIDDER_CODE + ': Empty bid response');
return bidResponses;
}

const CPM = serverBody.cpm;
const WIDTH = serverBody.width;
const HEIGHT = serverBody.height;
const CREATIVE = serverBody.content_url;
const CALLBACK_UID = serverBody.callback_uid;
const TIME_TO_LIVE = config.getConfig('_bidderTimeout');
const REFERER = utils.getWindowTop();
let bidRequest = request.bidRequest;
if (CPM > 0 && WIDTH > 0 && HEIGHT > 0) {
let bidResponse = {
requestId: bidRequest.bidId,
cpm: CPM,
width: WIDTH,
height: HEIGHT,
creativeId: CALLBACK_UID,
ttl: TIME_TO_LIVE,
referrer: REFERER,
currency: 'USD',
netRevenue: true,
adUrl: CREATIVE,
meta: {
advertiserDomains: serverBody.adomain ? serverBody.adomain : []
}
};
bidResponses.push(bidResponse);
}

return bidResponses;
}
};
registerBidder(spec);
Loading