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

PubMatic adds support for bidUserIdAsEids #5397

Merged
merged 44 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
33762d1
added support for pubcommon, digitrust, id5id
pm-harshad-mane Sep 12, 2019
0722354
added support for IdentityLink
pm-harshad-mane Sep 13, 2019
f2c32c0
changed the source for id5
pm-harshad-mane Sep 13, 2019
37163d1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 13, 2019
eaed987
added unit test cases
pm-harshad-mane Sep 13, 2019
602ee7e
changed source param for identityLink
pm-harshad-mane Sep 16, 2019
b6fcd36
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2019
58381f3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 26, 2019
c9fb11b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 10, 2019
8ece7fd
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
28d12a0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
05a55e1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 31, 2019
e8b10d5
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 5, 2019
870085f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
844ce4e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
704eca3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 13, 2019
2565cb9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
1d75bd4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
6adde1e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 6, 2019
477c98a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 9, 2019
cef5422
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 10, 2019
c110a7d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 9, 2020
e8fb062
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 5, 2020
d77cd71
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 17, 2020
817ce3f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 24, 2020
cda825e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 26, 2020
f34a3ec
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 27, 2020
f106dc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 4, 2020
1f6937e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
06ffe84
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
5448ceb
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
e9b90fe
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
a7a1d12
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
30b72df
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 26, 2020
c55be7f
id value should be string only
pm-harshad-mane Mar 26, 2020
7352ca4
id value should be string; changed test data
pm-harshad-mane Mar 26, 2020
89d2f71
pubmatic using userIdAsEids
pm-harshad-mane Mar 26, 2020
aab6026
chnages in test cases for userIdAsEids
pm-harshad-mane Mar 26, 2020
deabdb1
deleted commented code and test cases
pm-harshad-mane Mar 26, 2020
215835d
Merge remote-tracking branch 'upstream/master' into pubmatic_eids
pm-harshad-mane Apr 1, 2020
727f71a
deleted a commented line
pm-harshad-mane Apr 1, 2020
8d15f1c
Merge remote-tracking branch 'upstream/master' into pubmatic_eids
pm-harshad-mane Jun 9, 2020
71bae3a
Merge remote-tracking branch 'upstream/master' into pubmatic_eids
pm-harshad-mane Jun 18, 2020
582a407
lint effect
pm-harshad-mane Jun 18, 2020
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
88 changes: 3 additions & 85 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const USER_SYNC_URL_IFRAME = 'https://ads.pubmatic.com/AdServer/js/showad.js#PIX
const USER_SYNC_URL_IMAGE = 'https://image8.pubmatic.com/AdServer/ImgSync?p=';
const DEFAULT_CURRENCY = 'USD';
const AUCTION_TYPE = 1;
const PUBMATIC_DIGITRUST_KEY = 'nFIn8aLzbd';
const UNDEFINED = undefined;
const DEFAULT_WIDTH = 0;
const DEFAULT_HEIGHT = 0;
Expand Down Expand Up @@ -617,91 +616,10 @@ function _addFloorFromFloorModule(impObj, bid) {
impObj.bidfloor = ((!isNaN(bidFloor) && bidFloor > 0) ? bidFloor : UNDEFINED);
}

function _getDigiTrustObject(key) {
function getDigiTrustId() {
let digiTrustUser = window.DigiTrust && (config.getConfig('digiTrustId') || window.DigiTrust.getUser({member: key}));
return (digiTrustUser && digiTrustUser.success && digiTrustUser.identity) || null;
}
let digiTrustId = getDigiTrustId();
// Verify there is an ID and this user has not opted out
if (!digiTrustId || (digiTrustId.privacy && digiTrustId.privacy.optout)) {
return null;
}
return digiTrustId;
}

function _handleDigitrustId(eids) {
let digiTrustId = _getDigiTrustObject(PUBMATIC_DIGITRUST_KEY);
if (digiTrustId !== null) {
eids.push({
'source': 'digitru.st',
'uids': [{
'id': digiTrustId.id || '',
'atype': 1,
'ext': {
'keyv': parseInt(digiTrustId.keyv) || 0
}
}]
});
}
}

function _handleTTDId(eids, validBidRequests) {
let ttdId = null;
let adsrvrOrgId = config.getConfig('adsrvrOrgId');
if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.tdid'))) {
ttdId = validBidRequests[0].userId.tdid;
} else if (adsrvrOrgId && utils.isStr(adsrvrOrgId.TDID)) {
ttdId = adsrvrOrgId.TDID;
}

if (ttdId !== null) {
eids.push({
'source': 'adserver.org',
'uids': [{
'id': ttdId,
'atype': 1,
'ext': {
'rtiPartner': 'TDID'
}
}]
});
}
}

/**
* Produces external userid object in ortb 3.0 model.
*/
function _addExternalUserId(eids, value, source, atype) {
if (utils.isStr(value)) {
eids.push({
source,
uids: [{
id: value,
atype
}]
});
}
}

function _handleEids(payload, validBidRequests) {
let eids = [];
_handleDigitrustId(eids);
_handleTTDId(eids, validBidRequests);
const bidRequest = validBidRequests[0];
if (bidRequest && bidRequest.userId) {
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcid.org', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.digitrustid.data.id`), 'digitru.st', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteoId`), 'criteo.com', 1);// replacing criteoRtus
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.lipb.lipbid`), 'liveintent.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableid`), 'parrable.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.britepoolid`), 'britepool.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.netId`), 'netid.de', 1);
}
if (eids.length > 0) {
payload.user.eids = eids;
const bidUserIdAsEids = utils.deepAccess(validBidRequests, '0.userIdAsEids');
if (utils.isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
utils.deepSetValue(payload, 'user.eids', bidUserIdAsEids);
}
}

Expand Down
Loading