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

Yahoo user identity module: initial release #7519

Merged
merged 8 commits into from
Oct 15, 2021
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
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"akamaiDAPIdSystem",
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
"criteoIdSystem",
"deepintentDpesIdSystem",
"dmdIdSystem",
Expand Down
104 changes: 104 additions & 0 deletions modules/connectIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* This module adds support for Yahoo ConnectID to the user ID module system.
* The {@link module:modules/userId} module is required
* @module modules/connectIdSystem
* @requires module:modules/userId
*/

import {ajax} from '../src/ajax.js';
import {submodule} from '../src/hook.js';
import {logError, formatQS} from '../src/utils.js';
import includes from 'core-js-pure/features/array/includes.js';

const MODULE_NAME = 'connectId';
const VENDOR_ID = 25;
const PLACEHOLDER = '__PIXEL_ID__';
const UPS_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PLACEHOLDER}/fed`;

function isEUConsentRequired(consentData) {
return !!(consentData && consentData.gdpr && consentData.gdpr.gdprApplies);
}

/** @type {Submodule} */
export const connectIdSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: MODULE_NAME,
/**
* @type {Number}
*/
gvlid: VENDOR_ID,
/**
* decode the stored id value for passing to bid requests
* @function
* @returns {{connectId: string} | undefined}
*/
decode(value) {
return (typeof value === 'object' && value.connectid)
? {connectId: value.connectid} : undefined;
},
/**
* Gets the Yahoo ConnectID
* @function
* @param {SubmoduleConfig} [config]
* @param {ConsentData} [consentData]
* @returns {IdResponse|undefined}
*/
getId(config, consentData) {
const params = config.params || {};
if (!params || typeof params.he !== 'string' ||
(typeof params.pixelId === 'undefined' && typeof params.endpoint === 'undefined')) {
logError('The connectId submodule requires the \'he\' and \'pixelId\' parameters to be defined.');
return;
}

const data = {
'1p': includes([1, '1', true], params['1p']) ? '1' : '0',
he: params.he,
gdpr: isEUConsentRequired(consentData) ? '1' : '0',
gdpr_consent: isEUConsentRequired(consentData) ? consentData.gdpr.consentString : '',
us_privacy: consentData && consentData.uspConsent ? consentData.uspConsent : ''
};

if (params.pixelId) {
data.pixelId = params.pixelId
}

const resp = function (callback) {
const callbacks = {
success: response => {
let responseObj;
if (response) {
try {
responseObj = JSON.parse(response);
} catch (error) {
logError(error);
}
}
callback(responseObj);
},
error: error => {
logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
callback();
}
};
const endpoint = UPS_ENDPOINT.replace(PLACEHOLDER, params.pixelId);
let url = `${params.endpoint || endpoint}?${formatQS(data)}`;
connectIdSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true});
};
return {callback: resp};
},

/**
* Return the function used to perform XHR calls.
* Utilised for each of testing.
* @returns {Function}
*/
getAjaxFn() {
return ajax;
}
};

submodule('userId', connectIdSubmodule);
33 changes: 33 additions & 0 deletions modules/connectIdSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Yahoo ConnectID User ID Submodule

Yahoo ConnectID user ID Module.

### Prebid Params

```
pbjs.setConfig({
userSync: {
userIds: [{
name: 'connectId',
storage: {
name: 'connectId',
type: 'html5',
expires: 15
},
params: {
pixelId: 58776,
he: '0bef996248d63cea1529cb86de31e9547a712d9f380146e98bbd39beec70355a'
}
}]
}
});
```
## Parameter Descriptions for the `usersync` Configuration Section
The below parameters apply only to the Yahoo ConnectID user ID Module.

| Param under usersync.userIds[] | Scope | Type | Description | Example |
| --- | --- | --- | --- | --- |
| name | Required | String | ID value for the Yahoo ConnectID module - `"connectId"` | `"connectId"` |
| params | Required | Object | Data for Yahoo ConnectID initialization. | |
| params.pixelId | Required | Number | The Yahoo supplied publisher specific pixel Id | `8976` |
| params.he | Required | String | The SHA-256 hashed user email address | `"529cb86de31e9547a712d9f380146e98bbd39beec"` |
18 changes: 18 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,18 @@ const USER_IDS_CONFIG = {
source: 'neustar.biz',
atype: 1
},

// MediaWallah OpenLink
'mwOpenLinkId': {
source: 'mediawallahscript.com',
atype: 1
},

'tapadId': {
source: 'tapad.com',
atype: 1
},

// Novatiq Snowflake
'novatiq': {
getValue: function(data) {
Expand All @@ -198,47 +201,62 @@ const USER_IDS_CONFIG = {
source: 'novatiq.com',
atype: 1
},

'uid2': {
source: 'uidapi.com',
atype: 3,
getValue: function(data) {
return data.id;
}
},

// Akamai Data Activation Platform (DAP)
'dapId': {
source: 'akamai.com',
atype: 1
},

'deepintentId': {
source: 'deepintent.com',
atype: 3
},

// Admixer Id
'admixerId': {
source: 'admixer.net',
atype: 3
},

// Adtelligent Id
'adtelligentId': {
source: 'adtelligent.com',
atype: 3
},

amxId: {
source: 'amxrtb.com',
atype: 1,
},

'publinkId': {
source: 'epsilon.com',
atype: 3
},

'kpuid': {
source: 'kpuid.com',
atype: 3
},

'imuid': {
source: 'intimatemerger.com',
atype: 1
},

// Yahoo ConnectID
'connectId': {
source: 'yahoo.com',
atype: 3
}
};

Expand Down
7 changes: 7 additions & 0 deletions modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ userIdAsEids = [
id: 'some-random-id-value',
atype: 3
}]
},
{
source: 'yahoo.com',
uids: [{
id: 'some-random-id-value',
atype: 3
}]
}
]
```
12 changes: 12 additions & 0 deletions modules/userId/userId.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,18 @@ pbjs.setConfig({
params: {
cid: 5126 // Set your Intimate Merger Customer ID here for production
}
},
{
name: 'connectId',
params: {
pixelId: 58776,
he: '0bef996248d63cea1529cb86de31e9547a712d9f380146e98bbd39beec70355a'
},
storage: {
name: 'connectId',
type: 'html5',
expires: 15
}
}],
syncDelay: 5000
}
Expand Down
Loading