From 78879c7e0f0b1b948875e24abc319ad5032d402e Mon Sep 17 00:00:00 2001 From: slimkrazy Date: Thu, 30 Sep 2021 13:00:37 +0100 Subject: [PATCH 1/5] User ID module for Yahoo ConnectID --- modules/connectIDSystem.js | 104 ++++++++++++ modules/connectIDSystem.md | 33 ++++ modules/userId/eids.js | 18 +++ test/spec/modules/connectIDSystem_spec.js | 189 ++++++++++++++++++++++ 4 files changed, 344 insertions(+) create mode 100644 modules/connectIDSystem.js create mode 100644 modules/connectIDSystem.md create mode 100644 test/spec/modules/connectIDSystem_spec.js diff --git a/modules/connectIDSystem.js b/modules/connectIDSystem.js new file mode 100644 index 00000000000..9a51ac330b2 --- /dev/null +++ b/modules/connectIDSystem.js @@ -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 * as utils 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 Connect ID + * @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')) { + utils.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) { + utils.logError(error); + } + } + callback(responseObj); + }, + error: error => { + utils.logError(`${MODULE_NAME}: ID fetch encountered an error`, error); + callback(); + } + }; + const endpoint = UPS_ENDPOINT.replace(PLACEHOLDER, params.pixelId); + let url = `${params.endpoint || endpoint}?${utils.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); diff --git a/modules/connectIDSystem.md b/modules/connectIDSystem.md new file mode 100644 index 00000000000..014900579e5 --- /dev/null +++ b/modules/connectIDSystem.md @@ -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"` | diff --git a/modules/userId/eids.js b/modules/userId/eids.js index 0a8e94883b4..3231a6905c7 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -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) { @@ -198,6 +201,7 @@ const USER_IDS_CONFIG = { source: 'novatiq.com', atype: 1 }, + 'uid2': { source: 'uidapi.com', atype: 3, @@ -205,40 +209,54 @@ const USER_IDS_CONFIG = { 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 } }; diff --git a/test/spec/modules/connectIDSystem_spec.js b/test/spec/modules/connectIDSystem_spec.js new file mode 100644 index 00000000000..b1022e6e75e --- /dev/null +++ b/test/spec/modules/connectIDSystem_spec.js @@ -0,0 +1,189 @@ +import {expect} from 'chai'; +import * as utils from 'src/utils.js'; +import {connectIDSubmodule} from 'modules/connectIDSystem.js'; + +describe('Yahoo ConnectID Submodule', () => { + const HASHED_EMAIL = '6bda6f2fa268bf0438b5423a9861a2cedaa5dec163c03f743cfe05c08a8397b2'; + const PIXEL_ID = '1234'; + const PROD_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PIXEL_ID}/fed`; + const OVERRIDE_ENDPOINT = 'https://foo/bar'; + + it('should have the correct module name declared', () => { + expect(connectIDSubmodule.name).to.equal('connectID'); + }); + + it('should have the correct TCFv2 Vendor ID declared', () => { + expect(connectIDSubmodule.gvlid).to.equal(25); + }); + + describe('getId()', () => { + let ajaxStub; + let getAjaxFnStub; + let consentData; + beforeEach(() => { + ajaxStub = sinon.stub(); + getAjaxFnStub = sinon.stub(connectIDSubmodule, 'getAjaxFn'); + getAjaxFnStub.returns(ajaxStub); + + consentData = { + gdpr: { + gdprApplies: 1, + consentString: 'GDPR_CONSENT_STRING' + }, + uspConsent: 'USP_CONSENT_STRING' + }; + }); + + afterEach(() => { + getAjaxFnStub.restore(); + }); + + function invokeGetIdAPI(configParams, consentData) { + let result = connectIDSubmodule.getId({ + params: configParams + }, consentData); + if (typeof result === 'object') { + result.callback(sinon.stub()); + } + return result; + } + + it('returns undefined if he and pixelId params are not passed', () => { + expect(invokeGetIdAPI({}, consentData)).to.be.undefined; + expect(ajaxStub.callCount).to.equal(0); + }); + + it('returns undefined if the pixelId param is not passed', () => { + expect(invokeGetIdAPI({ + he: HASHED_EMAIL + }, consentData)).to.be.undefined; + expect(ajaxStub.callCount).to.equal(0); + }); + + it('returns undefined if the he param is not passed', () => { + expect(invokeGetIdAPI({ + pixelId: PIXEL_ID + }, consentData)).to.be.undefined; + expect(ajaxStub.callCount).to.equal(0); + }); + + it('returns an object with the callback function if the correct params are passed', () => { + let result = invokeGetIdAPI({ + he: HASHED_EMAIL, + pixelId: PIXEL_ID + }, consentData); + expect(result).to.be.an('object').that.has.all.keys('callback'); + expect(result.callback).to.be.a('function'); + }); + + it('Makes an ajax GET request to the production API endpoint with query params', () => { + invokeGetIdAPI({ + he: HASHED_EMAIL, + pixelId: PIXEL_ID + }, consentData); + + const expectedParams = { + he: HASHED_EMAIL, + pixelId: PIXEL_ID, + '1p': '0', + gdpr: '1', + gdpr_consent: consentData.gdpr.consentString, + us_privacy: consentData.uspConsent + }; + const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + + expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0); + expect(requestQueryParams).to.deep.equal(expectedParams); + expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true}); + }); + + it('Makes an ajax GET request to the specified override API endpoint with query params', () => { + invokeGetIdAPI({ + he: HASHED_EMAIL, + endpoint: OVERRIDE_ENDPOINT + }, consentData); + + const expectedParams = { + he: HASHED_EMAIL, + '1p': '0', + gdpr: '1', + gdpr_consent: consentData.gdpr.consentString, + us_privacy: consentData.uspConsent + }; + const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + + expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0); + expect(requestQueryParams).to.deep.equal(expectedParams); + expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true}); + }); + + it('sets the callbacks param of the ajax function call correctly', () => { + invokeGetIdAPI({ + he: HASHED_EMAIL, + pixelId: PIXEL_ID, + }, consentData); + + expect(ajaxStub.firstCall.args[1]).to.be.an('object').that.has.all.keys(['success', 'error']); + }); + + it('sets GDPR consent data flag correctly when call is under GDPR jurisdiction.', () => { + invokeGetIdAPI({ + he: HASHED_EMAIL, + pixelId: PIXEL_ID, + }, consentData); + + const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + expect(requestQueryParams.gdpr).to.equal('1'); + expect(requestQueryParams.gdpr_consent).to.equal(consentData.gdpr.consentString); + }); + + it('sets GDPR consent data flag correctly when call is NOT under GDPR jurisdiction.', () => { + consentData.gdpr.gdprApplies = false; + + invokeGetIdAPI({ + he: HASHED_EMAIL, + pixelId: PIXEL_ID, + }, consentData); + + const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + expect(requestQueryParams.gdpr).to.equal('0'); + expect(requestQueryParams.gdpr_consent).to.equal(''); + }); + + [1, '1', true].forEach(firstPartyParamValue => { + it(`sets 1p payload property to '1' for a config value of ${firstPartyParamValue}`, () => { + invokeGetIdAPI({ + '1p': firstPartyParamValue, + he: HASHED_EMAIL, + pixelId: PIXEL_ID, + }, consentData); + + const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + expect(requestQueryParams['1p']).to.equal('1'); + }); + }); + }); + + describe('decode()', () => { + const VALID_API_RESPONSES = [{ + key: 'connectid', + expected: '4567', + payload: { + connectid: '4567' + } + }]; + VALID_API_RESPONSES.forEach(responseData => { + it('should return a newly constructed object with the connect ID for a payload with ${responseData.key} key(s)', () => { + expect(connectIDSubmodule.decode(responseData.payload)).to.deep.equal( + {connectid: responseData.expected} + ); + }); + }); + + [{}, '', {foo: 'bar'}].forEach((response) => { + it(`should return undefined for an invalid response "${JSON.stringify(response)}"`, () => { + expect(connectIDSubmodule.decode(response)).to.be.undefined; + }); + }); + }); +}); From be91176f38723c1170c557a214757a8a8ba6cf6d Mon Sep 17 00:00:00 2001 From: slimkrazy Date: Thu, 30 Sep 2021 13:17:14 +0100 Subject: [PATCH 2/5] Stay in line with branding... --- modules/connectIDSystem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/connectIDSystem.js b/modules/connectIDSystem.js index 9a51ac330b2..4fad248f9e3 100644 --- a/modules/connectIDSystem.js +++ b/modules/connectIDSystem.js @@ -40,7 +40,7 @@ export const connectIDSubmodule = { ? {connectid: value.connectid} : undefined; }, /** - * Gets the Yahoo Connect ID + * Gets the Yahoo ConnectID * @function * @param {SubmoduleConfig} [config] * @param {ConsentData} [consentData] From d49d9b96f400cd6ec9bd2ef7a99065f53c239ad1 Mon Sep 17 00:00:00 2001 From: slimkrazy Date: Mon, 4 Oct 2021 11:47:27 +0100 Subject: [PATCH 3/5] Addressed PR feedback --- modules/connectIDSystem.js | 10 +++++----- test/spec/modules/connectIDSystem_spec.js | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/connectIDSystem.js b/modules/connectIDSystem.js index 4fad248f9e3..18d3d95b9fd 100644 --- a/modules/connectIDSystem.js +++ b/modules/connectIDSystem.js @@ -7,7 +7,7 @@ import {ajax} from '../src/ajax.js'; import {submodule} from '../src/hook.js'; -import * as utils from '../src/utils.js'; +import {logError, formatQS} from '../src/utils.js'; import includes from 'core-js-pure/features/array/includes.js'; const MODULE_NAME = 'connectID'; @@ -50,7 +50,7 @@ export const connectIDSubmodule = { const params = config.params || {}; if (!params || typeof params.he !== 'string' || (typeof params.pixelId === 'undefined' && typeof params.endpoint === 'undefined')) { - utils.logError('The connectId submodule requires the \'he\' and \'pixelId\' parameters to be defined.'); + logError('The connectId submodule requires the \'he\' and \'pixelId\' parameters to be defined.'); return; } @@ -74,18 +74,18 @@ export const connectIDSubmodule = { try { responseObj = JSON.parse(response); } catch (error) { - utils.logError(error); + logError(error); } } callback(responseObj); }, error: error => { - utils.logError(`${MODULE_NAME}: ID fetch encountered an 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}?${utils.formatQS(data)}`; + let url = `${params.endpoint || endpoint}?${formatQS(data)}`; connectIDSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true}); }; return {callback: resp}; diff --git a/test/spec/modules/connectIDSystem_spec.js b/test/spec/modules/connectIDSystem_spec.js index b1022e6e75e..a660fb76075 100644 --- a/test/spec/modules/connectIDSystem_spec.js +++ b/test/spec/modules/connectIDSystem_spec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import * as utils from 'src/utils.js'; +import {parseQS} from 'src/utils.js'; import {connectIDSubmodule} from 'modules/connectIDSystem.js'; describe('Yahoo ConnectID Submodule', () => { @@ -90,7 +90,7 @@ describe('Yahoo ConnectID Submodule', () => { gdpr_consent: consentData.gdpr.consentString, us_privacy: consentData.uspConsent }; - const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]); expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0); expect(requestQueryParams).to.deep.equal(expectedParams); @@ -110,7 +110,7 @@ describe('Yahoo ConnectID Submodule', () => { gdpr_consent: consentData.gdpr.consentString, us_privacy: consentData.uspConsent }; - const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]); expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0); expect(requestQueryParams).to.deep.equal(expectedParams); @@ -132,7 +132,7 @@ describe('Yahoo ConnectID Submodule', () => { pixelId: PIXEL_ID, }, consentData); - const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]); expect(requestQueryParams.gdpr).to.equal('1'); expect(requestQueryParams.gdpr_consent).to.equal(consentData.gdpr.consentString); }); @@ -145,7 +145,7 @@ describe('Yahoo ConnectID Submodule', () => { pixelId: PIXEL_ID, }, consentData); - const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]); expect(requestQueryParams.gdpr).to.equal('0'); expect(requestQueryParams.gdpr_consent).to.equal(''); }); @@ -158,7 +158,7 @@ describe('Yahoo ConnectID Submodule', () => { pixelId: PIXEL_ID, }, consentData); - const requestQueryParams = utils.parseQS(ajaxStub.firstCall.args[0].split('?')[1]); + const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]); expect(requestQueryParams['1p']).to.equal('1'); }); }); From 7544ef2d0fd56be455edf80e2cd25a7584caa291 Mon Sep 17 00:00:00 2001 From: slimkrazy Date: Tue, 12 Oct 2021 11:54:06 +0100 Subject: [PATCH 4/5] Addressing PR feedback --- .../{connectIDSystem.js => connectIdSystem.js} | 12 ++++++------ .../{connectIDSystem.md => connectIdSystem.md} | 6 +++--- modules/userId/eids.js | 2 +- ...tIDSystem_spec.js => connectIdSystem_spec.js} | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) rename modules/{connectIDSystem.js => connectIdSystem.js} (91%) rename modules/{connectIDSystem.md => connectIdSystem.md} (90%) rename test/spec/modules/{connectIDSystem_spec.js => connectIdSystem_spec.js} (92%) diff --git a/modules/connectIDSystem.js b/modules/connectIdSystem.js similarity index 91% rename from modules/connectIDSystem.js rename to modules/connectIdSystem.js index 18d3d95b9fd..ac44a8b5a2d 100644 --- a/modules/connectIDSystem.js +++ b/modules/connectIdSystem.js @@ -10,7 +10,7 @@ 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 MODULE_NAME = 'connectId'; const VENDOR_ID = 25; const PLACEHOLDER = '__PIXEL_ID__'; const UPS_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PLACEHOLDER}/fed`; @@ -20,7 +20,7 @@ function isEUConsentRequired(consentData) { } /** @type {Submodule} */ -export const connectIDSubmodule = { +export const connectIdSubmodule = { /** * used to link submodule with config * @type {string} @@ -33,11 +33,11 @@ export const connectIDSubmodule = { /** * decode the stored id value for passing to bid requests * @function - * @returns {{connectid: string} | undefined} + * @returns {{connectId: string} | undefined} */ decode(value) { return (typeof value === 'object' && value.connectid) - ? {connectid: value.connectid} : undefined; + ? {connectId: value.connectid} : undefined; }, /** * Gets the Yahoo ConnectID @@ -86,7 +86,7 @@ export const connectIDSubmodule = { }; const endpoint = UPS_ENDPOINT.replace(PLACEHOLDER, params.pixelId); let url = `${params.endpoint || endpoint}?${formatQS(data)}`; - connectIDSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true}); + connectIdSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true}); }; return {callback: resp}; }, @@ -101,4 +101,4 @@ export const connectIDSubmodule = { } }; -submodule('userId', connectIDSubmodule); +submodule('userId', connectIdSubmodule); diff --git a/modules/connectIDSystem.md b/modules/connectIdSystem.md similarity index 90% rename from modules/connectIDSystem.md rename to modules/connectIdSystem.md index 014900579e5..f2153e1b6cb 100644 --- a/modules/connectIDSystem.md +++ b/modules/connectIdSystem.md @@ -8,9 +8,9 @@ Yahoo ConnectID user ID Module. pbjs.setConfig({ userSync: { userIds: [{ - name: 'connectID', + name: 'connectId', storage: { - name: 'connectID', + name: 'connectId', type: 'html5', expires: 15 }, @@ -27,7 +27,7 @@ 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"` | +| 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"` | diff --git a/modules/userId/eids.js b/modules/userId/eids.js index f19bd9234d1..87b6ecc1f1c 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -254,7 +254,7 @@ const USER_IDS_CONFIG = { }, // Yahoo ConnectID - 'connectID': { + 'connectId': { source: 'yahoo.com', atype: 3 } diff --git a/test/spec/modules/connectIDSystem_spec.js b/test/spec/modules/connectIdSystem_spec.js similarity index 92% rename from test/spec/modules/connectIDSystem_spec.js rename to test/spec/modules/connectIdSystem_spec.js index a660fb76075..41135a74515 100644 --- a/test/spec/modules/connectIDSystem_spec.js +++ b/test/spec/modules/connectIdSystem_spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import {parseQS} from 'src/utils.js'; -import {connectIDSubmodule} from 'modules/connectIDSystem.js'; +import {connectIdSubmodule} from 'modules/connectIdSystem.js'; describe('Yahoo ConnectID Submodule', () => { const HASHED_EMAIL = '6bda6f2fa268bf0438b5423a9861a2cedaa5dec163c03f743cfe05c08a8397b2'; @@ -9,11 +9,11 @@ describe('Yahoo ConnectID Submodule', () => { const OVERRIDE_ENDPOINT = 'https://foo/bar'; it('should have the correct module name declared', () => { - expect(connectIDSubmodule.name).to.equal('connectID'); + expect(connectIdSubmodule.name).to.equal('connectId'); }); it('should have the correct TCFv2 Vendor ID declared', () => { - expect(connectIDSubmodule.gvlid).to.equal(25); + expect(connectIdSubmodule.gvlid).to.equal(25); }); describe('getId()', () => { @@ -22,7 +22,7 @@ describe('Yahoo ConnectID Submodule', () => { let consentData; beforeEach(() => { ajaxStub = sinon.stub(); - getAjaxFnStub = sinon.stub(connectIDSubmodule, 'getAjaxFn'); + getAjaxFnStub = sinon.stub(connectIdSubmodule, 'getAjaxFn'); getAjaxFnStub.returns(ajaxStub); consentData = { @@ -39,7 +39,7 @@ describe('Yahoo ConnectID Submodule', () => { }); function invokeGetIdAPI(configParams, consentData) { - let result = connectIDSubmodule.getId({ + let result = connectIdSubmodule.getId({ params: configParams }, consentData); if (typeof result === 'object') { @@ -174,15 +174,15 @@ describe('Yahoo ConnectID Submodule', () => { }]; VALID_API_RESPONSES.forEach(responseData => { it('should return a newly constructed object with the connect ID for a payload with ${responseData.key} key(s)', () => { - expect(connectIDSubmodule.decode(responseData.payload)).to.deep.equal( - {connectid: responseData.expected} + expect(connectIdSubmodule.decode(responseData.payload)).to.deep.equal( + {connectId: responseData.expected} ); }); }); [{}, '', {foo: 'bar'}].forEach((response) => { it(`should return undefined for an invalid response "${JSON.stringify(response)}"`, () => { - expect(connectIDSubmodule.decode(response)).to.be.undefined; + expect(connectIdSubmodule.decode(response)).to.be.undefined; }); }); }); From ad1b238d4ffd9018d65cbddb38d9f51366689dd8 Mon Sep 17 00:00:00 2001 From: slimkrazy Date: Fri, 15 Oct 2021 22:04:05 +0100 Subject: [PATCH 5/5] Addressing PR feedback --- modules/.submodules.json | 1 + modules/userId/eids.md | 7 +++++++ modules/userId/userId.md | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/modules/.submodules.json b/modules/.submodules.json index 3ac1e1ef59f..ea3f556dbb4 100644 --- a/modules/.submodules.json +++ b/modules/.submodules.json @@ -5,6 +5,7 @@ "akamaiDAPIdSystem", "amxIdSystem", "britepoolIdSystem", + "connectIdSystem", "criteoIdSystem", "deepintentDpesIdSystem", "dmdIdSystem", diff --git a/modules/userId/eids.md b/modules/userId/eids.md index a8e73216327..679bf5ffe27 100644 --- a/modules/userId/eids.md +++ b/modules/userId/eids.md @@ -210,6 +210,13 @@ userIdAsEids = [ id: 'some-random-id-value', atype: 3 }] + }, + { + source: 'yahoo.com', + uids: [{ + id: 'some-random-id-value', + atype: 3 + }] } ] ``` diff --git a/modules/userId/userId.md b/modules/userId/userId.md index 88460093c63..095685aba3d 100644 --- a/modules/userId/userId.md +++ b/modules/userId/userId.md @@ -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 }