-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
PAIR: Support for Generic TechLab Version #12146
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -16,7 +16,10 @@ import {MODULE_TYPE_UID} from '../src/activities/modules.js'; | |||||||||||||||||||||
|
||||||||||||||||||||||
const MODULE_NAME = 'pairId'; | ||||||||||||||||||||||
const PAIR_ID_KEY = 'pairId'; | ||||||||||||||||||||||
const DEFAULT_LIVERAMP_PAIR_ID_KEY = '_lr_pairId'; | ||||||||||||||||||||||
|
||||||||||||||||||||||
const DEFAULT_STORAGE_PAID_ID_KEYS = { | ||||||||||||||||||||||
liveramp: '_lr_pairId' | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME}); | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -35,11 +38,6 @@ export const pairIdSubmodule = { | |||||||||||||||||||||
* @type {string} | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
name: MODULE_NAME, | ||||||||||||||||||||||
/** | ||||||||||||||||||||||
* used to specify vendor id | ||||||||||||||||||||||
* @type {number} | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
gvlid: 755, | ||||||||||||||||||||||
/** | ||||||||||||||||||||||
* decode the stored id value for passing to bid requests | ||||||||||||||||||||||
* @function | ||||||||||||||||||||||
|
@@ -59,6 +57,7 @@ export const pairIdSubmodule = { | |||||||||||||||||||||
getId(config) { | ||||||||||||||||||||||
const pairIdsString = pairIdFromLocalStorage(PAIR_ID_KEY) || pairIdFromCookie(PAIR_ID_KEY) | ||||||||||||||||||||||
let ids = [] | ||||||||||||||||||||||
|
||||||||||||||||||||||
if (pairIdsString && typeof pairIdsString == 'string') { | ||||||||||||||||||||||
try { | ||||||||||||||||||||||
ids = ids.concat(JSON.parse(atob(pairIdsString))) | ||||||||||||||||||||||
|
@@ -67,14 +66,20 @@ export const pairIdSubmodule = { | |||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
const configParams = (config && config.params) || {}; | ||||||||||||||||||||||
if (configParams && configParams.liveramp) { | ||||||||||||||||||||||
let LRStorageLocation = configParams.liveramp.storageKey || DEFAULT_LIVERAMP_PAIR_ID_KEY; | ||||||||||||||||||||||
const liverampValue = pairIdFromLocalStorage(LRStorageLocation) || pairIdFromCookie(LRStorageLocation); | ||||||||||||||||||||||
const configParams = (config && config.params) ? config.params : {}; | ||||||||||||||||||||||
const cleanRooms = Object.keys(configParams); | ||||||||||||||||||||||
|
||||||||||||||||||||||
if (liverampValue) { | ||||||||||||||||||||||
for (let i = 0; i < cleanRooms.length; i++) { | ||||||||||||||||||||||
const cleanRoom = cleanRooms[i]; | ||||||||||||||||||||||
const cleanRoomParams = configParams[cleanRoom]; | ||||||||||||||||||||||
|
||||||||||||||||||||||
const cleanRoomStorageLocation = cleanRoomParams.storageKey || DEFAULT_STORAGE_PAID_ID_KEYS[cleanRoom]; | ||||||||||||||||||||||
const cleanRoomValue = pairIdFromLocalStorage(cleanRoomStorageLocation) || pairIdFromCookie(cleanRoomStorageLocation); | ||||||||||||||||||||||
Comment on lines
+72
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
JS made this a little more convienent 😄 Suggestion won't fully work as there's probably a closing brace missing |
||||||||||||||||||||||
|
||||||||||||||||||||||
if (cleanRoomValue) { | ||||||||||||||||||||||
try { | ||||||||||||||||||||||
const parsedValue = atob(liverampValue); | ||||||||||||||||||||||
const parsedValue = atob(cleanRoomValue); | ||||||||||||||||||||||
|
||||||||||||||||||||||
if (parsedValue) { | ||||||||||||||||||||||
const obj = JSON.parse(parsedValue); | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -90,20 +95,21 @@ export const pairIdSubmodule = { | |||||||||||||||||||||
logInfo('Pairid: Error parsing JSON: ', error); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} else { | ||||||||||||||||||||||
logInfo('Pairid: liverampValue for pairId from storage is empty or null'); | ||||||||||||||||||||||
logInfo('Pairid: data clean room value for pairId from storage is empty or null'); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
if (ids.length == 0) { | ||||||||||||||||||||||
logInfo('PairId not found.') | ||||||||||||||||||||||
return undefined; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
return {'id': ids}; | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
eids: { | ||||||||||||||||||||||
'pairId': { | ||||||||||||||||||||||
source: 'google.com', | ||||||||||||||||||||||
atype: 571187 | ||||||||||||||||||||||
source: 'iabtechlab.com', | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In future IAB may support another Alt ID, so the source for PAIR should clearly mention what it is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't that what atype is for? like a single source can have multiple id types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. atype identifies the user agent types a user identifier is from. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @therevoltingx mentioned we will have a unique atype to identify eid as a PAIR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this? I assumed it was the ID type which is now a techlab id type |
||||||||||||||||||||||
atype: 3 | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
} | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this configurable. Should be the DSP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not included in the bid request at all. this is the owner of the module. we need prebid to confirm.
the prefered thing to do is to leave as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
VENDORLESS_GVLID
here