Skip to content

Newspassid Bid Adapter: initial release #8567

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

Merged
merged 16 commits into from
Jul 12, 2022
Merged
Changes from 1 commit
Commits
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
38 changes: 5 additions & 33 deletions modules/newspassidBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { logInfo, logError, deepAccess, logWarn, deepSetValue, isArray, contains, isStr } from '../src/utils.js';
import { logInfo, logError, deepAccess, logWarn, deepSetValue, isArray, contains } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE } from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import {getPriceBucketString} from '../src/cpmBucketManager.js';
import {getRefererInfo} from '../src/refererDetection.js';
const BIDDER_CODE = 'newspassid';
const ORIGIN = 'https://bidder.newspassid.com' // applies only to auction & cookie
const AUCTIONURI = '/openrtb2/auction';
Expand Down Expand Up @@ -220,10 +221,11 @@ export const spec = {
if (getParams.hasOwnProperty('nprp') && getParams.nprp.match(/^[0-3]$/)) { extObj['newspassid']['nprp'] = parseInt(getParams.nprp); }
if (getParams.hasOwnProperty('npip') && getParams.npip.match(/^\d+$/)) { extObj['newspassid']['npip'] = parseInt(getParams.npip); }
if (this.propertyBag.endpointOverride != null) { extObj['newspassid']['origin'] = this.propertyBag.endpointOverride; }
var userExtEids = this.generateEids(validBidRequests); // generate the UserIDs in the correct format for UserId module
let userExtEids = deepAccess(validBidRequests, '0.userIdAsEids', []); // generate the UserIDs in the correct format for UserId module
let refererInfo = getRefererInfo();
npRequest.site = {
'publisher': {'id': htmlParams.publisherId},
'page': document.location.href,
'page': refererInfo.location,
'id': htmlParams.siteId
};
npRequest.test = (getParams.hasOwnProperty('pbjs_debug') && getParams['pbjs_debug'] === 'true') ? 1 : 0;
Expand Down Expand Up @@ -475,36 +477,6 @@ export const spec = {
}
return null;
},
generateEids(validBidRequests) {
let eids;
const bidRequest = validBidRequests[0];
if (bidRequest && bidRequest.userId) {
eids = bidRequest.userIdAsEids;
this.handleTTDId(eids, validBidRequests);
}
return eids;
},
handleTTDId(eids, validBidRequests) {
let ttdId = null;
let adsrvrOrgId = config.getConfig('adsrvrOrgId');
if (isStr(deepAccess(validBidRequests, '0.userId.tdid'))) {
ttdId = validBidRequests[0].userId.tdid;
} else if (adsrvrOrgId && isStr(adsrvrOrgId.TDID)) {
ttdId = adsrvrOrgId.TDID;
}
if (ttdId !== null) {
eids.push({
'source': 'adserver.org',
'uids': [{
'id': ttdId,
'atype': 1,
'ext': {
'rtiPartner': 'TDID'
}
}]
});
}
},
getGetParametersAsObject() {
let items = location.search.substr(1).split('&');
let ret = {};
Expand Down