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

Mediago / Discovery Bid Adapters : update reporting of eids to server #9539

Merged
merged 26 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d34c542
Mediago Bid Adapter:new adapter
Aug 17, 2022
dfea766
remove console
Aug 18, 2022
ba97c8a
change spec file to fix CircleCI
Aug 18, 2022
d96c1fc
change spec file to fix CircleCI
Aug 18, 2022
66bf6a0
change spec file
Aug 18, 2022
461cf79
Update mediagoBidAdapter.js
BaronJHYu Aug 24, 2022
618809e
Update mediagoBidAdapter.js
Aug 24, 2022
d4e14f7
rerun CurcleCi
BaronJHYu Aug 24, 2022
da74779
update mediagoBidAdapter
Sep 16, 2022
801884b
Merge branch 'master' of github.com:BaronJHYu/Prebid.js
Sep 16, 2022
63b7cc5
Merge branch 'master' of github.com:prebid/Prebid.js into prebid-master
Sep 16, 2022
8e4199c
Merge branch 'prebid-master'
Sep 16, 2022
20353cb
Merge branch 'prebid:master' into master
BaronJHYu Nov 16, 2022
b52fd79
update discoveryBidAdapter
Nov 16, 2022
541cfed
Merge branch 'prebid:master' into master
BaronJHYu Nov 30, 2022
9a55054
Discovery Bid Adapter : parameter updates
Nov 30, 2022
355d2b1
Mediago Bid Adapter : parameter updates
Nov 30, 2022
6fb0a02
Mediago Bid Adapter : code style format
Nov 30, 2022
68dcbd8
rerun circleci
Nov 30, 2022
bb2777c
rerun circleci
Dec 1, 2022
0ed9493
rerun circleci
Dec 1, 2022
d09cf94
rerun circleci
Dec 1, 2022
9e42186
Merge branch 'prebid:master' into master
BaronJHYu Feb 14, 2023
28b5d2b
Update mediagoBidAdapter & discoveryBidAdapter:report eids to server
Feb 14, 2023
809dc71
Merge branch 'master' of github.com:BaronJHYu/Prebid.js
Feb 14, 2023
5c24963
Update mediagoBidAdapter & discoveryBidAdapter:report eids to server
Feb 14, 2023
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
34 changes: 22 additions & 12 deletions modules/discoveryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const NATIVERET = {
title: {
len: 75,
},
}
},
],
plcmttype: 1,
privacy: 1,
Expand All @@ -63,9 +63,9 @@ const getUserID = () => {
let idm = storage.getCookie(COOKIE_KEY_MGUID);

if (idd && !idm) {
idm = idd
idm = idd;
} else if (idm && !idd) {
idd = idm
idd = idm;
} else if (!idd && !idm) {
const uuid = utils.generateUUID();
storage.setCookie(COOKIE_KEY_MGUID, uuid);
Expand Down Expand Up @@ -228,7 +228,7 @@ function getItems(validBidRequests, bidderRequest) {
let id = '' + (i + 1);

if (mediaTypes.native) {
ret = { ...NATIVERET, ...{ id, bidFloor } }
ret = { ...NATIVERET, ...{ id, bidFloor } };
}
// banner
if (mediaTypes.banner) {
Expand Down Expand Up @@ -276,6 +276,11 @@ function getItems(validBidRequests, bidderRequest) {
*/
function getParam(validBidRequests, bidderRequest) {
const pubcid = utils.deepAccess(validBidRequests[0], 'crumbs.pubcid');
const sharedid =
utils.deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
utils.deepAccess(validBidRequests[0], 'userId.pubcid');
const eids = validBidRequests[0].userIdAsEids || validBidRequests[0].userId;

let isMobile = getDevice() ? 1 : 0;
// input test status by Publisher. more frequently for test true req
let isTest = validBidRequests[0].params.test || 0;
Expand All @@ -284,7 +289,8 @@ function getParam(validBidRequests, bidderRequest) {

const timeout = bidderRequest.timeout || 2000;

const domain = utils.deepAccess(bidderRequest, 'refererInfo.domain') || document.domain;
const domain =
utils.deepAccess(bidderRequest, 'refererInfo.domain') || document.domain;
const location = utils.deepAccess(bidderRequest, 'refererInfo.referer');
const page = utils.deepAccess(bidderRequest, 'refererInfo.page');
const referer = utils.deepAccess(bidderRequest, 'refererInfo.ref');
Expand All @@ -304,10 +310,14 @@ function getParam(validBidRequests, bidderRequest) {
ua: navigator.userAgent,
language: /en/.test(navigator.language) ? 'en' : navigator.language,
},
ext: {
eids,
},
user: {
buyeruid: getUserID(),
id: pubcid,
id: sharedid || pubcid,
},
eids,
tmax: timeout,
site: {
name: domain,
Expand All @@ -317,7 +327,7 @@ function getParam(validBidRequests, bidderRequest) {
mobile: isMobile,
cat: [], // todo
publisher: {
id: globals['publisher']
id: globals['publisher'],
// todo
// name: xxx
},
Expand Down Expand Up @@ -401,8 +411,8 @@ export const spec = {
nurl: getKv(bid, 'nurl'),
ttl: TIME_TO_LIVE,
meta: {
advertiserDomains: getKv(bid, 'adomain') || []
}
advertiserDomains: getKv(bid, 'adomain') || [],
},
};
if (mediaType === 'native') {
const adm = getKv(bid, 'adm');
Expand Down Expand Up @@ -448,7 +458,7 @@ export const spec = {
native.impressionTrackers.push(tracker.url);
break;
// case 2:
// native.javascriptTrackers = `<script src=\"${tracker.url}\"></script>`;
// native.javascriptTrackers = `<script src=\'${tracker.url}\'></script>`;
// break;
}
});
Expand Down Expand Up @@ -484,8 +494,8 @@ export const spec = {
*/
onBidWon: function (bid) {
if (bid['nurl']) {
utils.triggerPixel(bid['nurl'])
utils.triggerPixel(bid['nurl']);
}
}
},
};
registerBidder(spec);
39 changes: 22 additions & 17 deletions modules/mediagoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ function isMobileAndTablet() {
*/
// function getBidFloor(bid, mediaType, sizes) {
// var floor;
// var size = sizes.length === 1 ? sizes[0] : "*";
// if (typeof bid.getFloor === "function") {
// const floorInfo = bid.getFloor({ currency: "USD", mediaType, size });
// var size = sizes.length === 1 ? sizes[0] : '*';
// if (typeof bid.getFloor === 'function') {
// const floorInfo = bid.getFloor({ currency: 'USD', mediaType, size });
// if (
// typeof floorInfo === "object" &&
// floorInfo.currency === "USD" &&
// typeof floorInfo === 'object' &&
// floorInfo.currency === 'USD' &&
// !isNaN(parseFloat(floorInfo.floor))
// ) {
// floor = parseFloat(floorInfo.floor);
Expand Down Expand Up @@ -255,7 +255,6 @@ function getItems(validBidRequests, bidderRequest) {
// utils.deepAccess(req, 'ortb2Imp.ext.gpid') ||
// utils.deepAccess(req, 'ortb2Imp.ext.data.pbadslot') ||
// utils.deepAccess(req, 'params.placementId', 0);
// console.log("wjh getItems:", req, bidFloor, gpid);

// if (mediaTypes.native) {}
// banner广告类型
Expand All @@ -270,7 +269,7 @@ function getItems(validBidRequests, bidderRequest) {
pos: 1,
},
ext: {
// gpid: gpid, // 加入后无法返回广告
// gpid: gpid, // 加入后无法返回广告
},
};
itemMaps[id] = {
Expand All @@ -296,6 +295,8 @@ function getParam(validBidRequests, bidderRequest) {
const sharedid =
utils.deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
utils.deepAccess(validBidRequests[0], 'userId.pubcid');
const eids = validBidRequests[0].userIdAsEids || validBidRequests[0].userId;

let isMobile = isMobileAndTablet() ? 1 : 0;
// input test status by Publisher. more frequently for test true req
let isTest = validBidRequests[0].params.test || 0;
Expand All @@ -318,19 +319,23 @@ function getParam(validBidRequests, bidderRequest) {
cur: ['USD'],
device: {
connectiontype: 0,
// ip: '64.188.178.115',
// ip: '98.61.5.0',
js: 1,
// language: "en",
// os: "Microsoft Windows",
// ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19043",
// language: 'en',
// os: 'Microsoft Windows',
// ua: 'Mozilla/5.0 (Linux; Android 12; SM-G970U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36',
os: navigator.platform || '',
ua: navigator.userAgent,
language: /en/.test(navigator.language) ? 'en' : navigator.language,
},
ext: {},
ext: {
eids,
},
user: {
id: sharedid || pubcid || getUserID(),
buyeruid: getUserID(),
id: sharedid || pubcid,
},
eids,
site: {
name: domain,
domain: domain,
Expand Down Expand Up @@ -420,12 +425,12 @@ export const spec = {
nurl: getProperty(bid, 'nurl'),
// adserverTargeting: {
// granularityMultiplier: 0.1,
// priceGranularity: "pbHg",
// pbMg: "0.01",
// priceGranularity: 'pbHg',
// pbMg: '0.01',
// },
// pbMg: "0.01",
// pbMg: '0.01',
// granularityMultiplier: 0.1,
// priceGranularity: "pbHg",
// priceGranularity: 'pbHg',
};
bidResponses.push(bidResponse);
}
Expand Down