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

Https and userid #2

Merged
merged 2 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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: 28 additions & 10 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const BIDDER_CODE = 'openx';
const BIDDER_CONFIG = 'hb_pb';
const BIDDER_VERSION = '2.1.7';


const USER_ID_CODE_TO_QUERY_ARG = {
idl_env: 'lre', // liveramp
pubcid: 'pubcid', // publisher common id
tdid: 'ttduuid' // the trade desk
};

let shouldSendBoPixel = true;

export function resetBoPixel() {
Expand Down Expand Up @@ -59,7 +66,7 @@ export const spec = {
let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
let url = utils.deepAccess(responses, '0.body.ads.pixels') ||
utils.deepAccess(responses, '0.body.pixels') ||
'//u.openx.net/w/1.0/pd';
'https://u.openx.net/w/1.0/pd';
return [{
type: pixelType,
url: url
Expand Down Expand Up @@ -237,15 +244,26 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
}
}

if ((bids[0].userId && bids[0].userId.pubcid)) {
defaultParams.pubcid = bids[0].userId.pubcid;
} else if (bids[0].crumbs && bids[0].crumbs.pubcid) {
defaultParams.pubcid = bids[0].crumbs.pubcid;
// normalize publisher common id
if (utils.deepAccess(bids[0], 'crumbs.pubcid')) {
utils.deepSetValue(bids[0], 'userId.pubcid', utils.deepAccess(bids[0], 'crumbs.pubcid'));
}

defaultParams = appendUserIdsToQueryParams(defaultParams, bids[0].userId);

return defaultParams;
}

function appendUserIdsToQueryParams(queryParams, userIds) {
utils._each(userIds, (userIdValue, userIdProviderKey) => {
if (USER_ID_CODE_TO_QUERY_ARG.hasOwnProperty(userIdProviderKey)) {
queryParams[USER_ID_CODE_TO_QUERY_ARG[userIdProviderKey]] = userIdValue;
}
});

return queryParams;
}

function buildOXBannerRequest(bids, bidderRequest) {
let customParamsForAllBids = [];
let hasCustomParam = false;
Expand Down Expand Up @@ -295,8 +313,8 @@ function buildOXBannerRequest(bids, bidderRequest) {
}

let url = queryParams.ph
? `//u.openx.net/w/1.0/arj`
: `//${bids[0].params.delDomain}/w/1.0/arj`;
? `https://u.openx.net/w/1.0/arj`
: `https://${bids[0].params.delDomain}/w/1.0/arj`;

return {
method: 'GET',
Expand All @@ -309,8 +327,8 @@ function buildOXBannerRequest(bids, bidderRequest) {
function buildOXVideoRequest(bid, bidderRequest) {
let oxVideoParams = generateVideoParameters(bid, bidderRequest);
let url = oxVideoParams.ph
? `//u.openx.net/v/1.0/avjp`
: `//${bid.params.delDomain}/v/1.0/avjp`;
? `https://u.openx.net/v/1.0/avjp`
: `https://${bid.params.delDomain}/v/1.0/avjp`;
return {
method: 'GET',
url: url,
Expand Down Expand Up @@ -425,7 +443,7 @@ function registerBeacon(mediaType, adUnit, startTime) {
if (mediaType === VIDEO) {
let url = parse(adUnit.colo);
beaconParams.ph = adUnit.ph;
beaconUrl = `//${url.hostname}/w/1.0/bo?${buildQueryStringFromParams(beaconParams)}`
beaconUrl = `https://${url.hostname}/w/1.0/bo?${buildQueryStringFromParams(beaconParams)}`
} else {
let recordPixel = utils.deepAccess(adUnit, 'creative.0.tracking.impression');
let boBase = recordPixel.match(/([^?]+\/)ri\?/);
Expand Down
Loading