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

New PubProvided Id UserId Submodule #5767

Merged
merged 38 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b2eeeeb
PubProvided Module
MarkoYerkovichRP Sep 17, 2020
cda2b86
-
MarkoYerkovichRP Sep 17, 2020
93b8468
formatting
MarkoYerkovichRP Sep 17, 2020
3008291
formatting
MarkoYerkovichRP Sep 18, 2020
d51ee5c
Added rubiconBidAdapter support
MarkoYerkovichRP Sep 21, 2020
1a0fe24
formatting
MarkoYerkovichRP Sep 21, 2020
286a90f
Merge branch 'master' into pubProvided
MarkoYerkovichRP Sep 21, 2020
546e331
formatting
MarkoYerkovichRP Sep 21, 2020
974fbba
formatting
MarkoYerkovichRP Sep 21, 2020
983317f
formatting
MarkoYerkovichRP Sep 21, 2020
f0a230c
commit to rerun build
MarkoYerkovichRP Sep 21, 2020
af408b0
type changes
MarkoYerkovichRP Sep 21, 2020
3dd1b99
type changes
MarkoYerkovichRP Sep 21, 2020
114005a
type changes
MarkoYerkovichRP Sep 21, 2020
9f7a32c
Revert "type changes"
MarkoYerkovichRP Sep 22, 2020
e488edb
Revert "type changes"
MarkoYerkovichRP Sep 22, 2020
5d0b2c1
formatting
MarkoYerkovichRP Sep 22, 2020
b296b2e
formatting
MarkoYerkovichRP Sep 22, 2020
bce5b25
formatting
MarkoYerkovichRP Sep 22, 2020
a02bd15
formatting
MarkoYerkovichRP Sep 22, 2020
6339bb0
formatting
MarkoYerkovichRP Sep 22, 2020
2e0f6d8
Revert "type changes"
MarkoYerkovichRP Sep 22, 2020
476519b
formatting
MarkoYerkovichRP Sep 22, 2020
c7818f6
formatting
MarkoYerkovichRP Sep 22, 2020
7c60c34
formatting
MarkoYerkovichRP Sep 22, 2020
8d36ae8
formatting
MarkoYerkovichRP Sep 22, 2020
597e4c0
commit to rerun build
MarkoYerkovichRP Sep 22, 2020
24b571d
commit to rerun build
MarkoYerkovichRP Sep 22, 2020
9a0583d
commit to rerun build
MarkoYerkovichRP Sep 22, 2020
f4cf127
rubiconBidAdapter changes
MarkoYerkovichRP Sep 23, 2020
6c9d5b5
Merge branch 'upstream' into pubProvided
MarkoYerkovichRP Sep 23, 2020
e6fd58f
rubiconBidAdapter changes
MarkoYerkovichRP Sep 23, 2020
76185b2
rubiconBidAdapter changes
MarkoYerkovichRP Sep 23, 2020
91b3106
trigger build
MarkoYerkovichRP Sep 23, 2020
2253c92
fix
MarkoYerkovichRP Sep 23, 2020
59f8356
fix
MarkoYerkovichRP Sep 23, 2020
f67e018
fix
MarkoYerkovichRP Sep 23, 2020
6605e58
rebuild
MarkoYerkovichRP Sep 23, 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
27 changes: 27 additions & 0 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@
googletag.pubads().disableInitialLoad();
});

const eidsProvider = function(){
return [{
source: "provider.com",
uids:[{
id: "value read from cookie or local storage"
}]
}];
};

pbjs.que.push(function() {
pbjs.setConfig({
debug: true,
Expand All @@ -130,6 +139,24 @@
// },
userSync: {
userIds: [{
name: "publisherProvided",
params: {
eids: [{
source: "example.com",
uids:[{
id: "value read from cookie or local storage",
ext: {
}
}]
},{
source: "id-partner.com",
uids:[{
id: "value read from cookie or local storage"
}]
}],
eidsFunction: eidsProvider
}
},{
name: "unifiedId",
params: {
partner: "prebid",
Expand Down
52 changes: 52 additions & 0 deletions modules/pubProvidedSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* This module adds Publisher Provided ids support to the User ID module
* The {@link module:modules/userId} module is required.
* @module modules/pubProvidedSystem
* @requires module:modules/userId
*/

import {submodule} from '../src/hook.js';
import * as utils from "../src/utils";

const MODULE_NAME = 'publisherProvided';

/** @type {Submodule} */
export const pubProvidedSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: MODULE_NAME,

/**
* decode the stored id value for passing to bid request
* @function
* @param {string} value
* @returns {{pubProvided: array}} or undefined if value doesn't exists
*/
decode(value) {
const res = value ? {pubProvided: value} : undefined;
utils.logInfo('PubProvidedId: Decoded value ' + JSON.stringify(res));
return res;
},

/**
* performs action to obtain id and return a value.
* @function
* @param {SubmoduleParams} [configParams]
* @returns {{id: array}}
*/
getId(configParams) {
let res = [];
smenzer marked this conversation as resolved.
Show resolved Hide resolved
if (Array.isArray(configParams.eids)) {
YerkovichM marked this conversation as resolved.
Show resolved Hide resolved
res = res.concat(configParams.eids);
}
if (typeof configParams.eidsFunction === 'function') {
res = res.concat(configParams.eidsFunction());
}
return {id: res};
jdwieland8282 marked this conversation as resolved.
Show resolved Hide resolved
}
};

// Register submodule for userId
submodule('userId', pubProvidedSubmodule);
10 changes: 7 additions & 3 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ export function createEidsArray(bidRequestUserId) {
let eids = [];
for (const subModuleKey in bidRequestUserId) {
if (bidRequestUserId.hasOwnProperty(subModuleKey)) {
const eid = createEidObject(bidRequestUserId[subModuleKey], subModuleKey);
if (eid) {
eids.push(eid);
if(subModuleKey === "pubProvided"){
YerkovichM marked this conversation as resolved.
Show resolved Hide resolved
eids = eids.concat(bidRequestUserId["pubProvided"]);
} else {
const eid = createEidObject(bidRequestUserId[subModuleKey], subModuleKey);
if (eid) {
eids.push(eid);
}
}
}
}
Expand Down