diff --git a/modules.json b/modules.json index 770ecc57788..eb7966ddef6 100644 --- a/modules.json +++ b/modules.json @@ -1 +1 @@ -["pubmaticBidAdapter","appnexusBidAdapter","userId","pubCommonId","identityLinkIdSystem","digiTrustIdSystem","id5IdSystem","customIdSystem","unifiedIdSystem"] +["appnexusBidAdapter","consentManagement","sekindoUMBidAdapter","pulsepointBidAdapter","audienceNetworkBidAdapter","openxBidAdapter","rubiconBidAdapter","sovrnBidAdapter","pubmaticBidAdapter","adgenerationBidAdapter","pubmaticServerBidAdapter","ixBidAdapter","criteoBidAdapter","userId"] diff --git a/modules/.submodules.json b/modules/.submodules.json index a68ec731c11..c0e30037660 100644 --- a/modules/.submodules.json +++ b/modules/.submodules.json @@ -2,8 +2,7 @@ "userId": [ "digiTrustIdSystem", "id5IdSystem", - "criteortusIdSystem", - "customIdSystem" + "criteortusIdSystem" ], "adpod": [ "freeWheelAdserverVideo", diff --git a/modules/customIdSystem.js b/modules/customIdSystem.js deleted file mode 100644 index 0a86e77f096..00000000000 --- a/modules/customIdSystem.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This module adds Custom Id to the User ID module - * The {@link module:modules/userId} module is required - * @module modules/customIdSystem - * @requires module:modules/userId - */ - -import * as utils from '../src/utils'; -import {submodule} from '../src/hook'; - -/** @type {Submodule} */ -export const customIdSubmodule = { - /** - * used to link submodule with config - * @type {string} - */ - name: 'customId', - /** - * decode the stored id value for passing to bid requests - * @function - * @param {string} value - * @returns {{customData:string}} - */ - decode(value) { - return { 'customData': value } - }, - - getDataFromCookieName: function (e) { - if (e && window.document.cookie) { - var t = window.document.cookie.match('(^|;)\\s*' + e + '\\s*=\\s*([^;]*)\\s*(;|$)'); - return t ? decodeURIComponent(t[2]) : null - } - return null - }, - getDataFromFunction: function(fnName) { - var fn = window[fnName]; - var data = ''; - if (typeof fn == 'function') { - data = fn(); - } else { - utils.logError('User ID - customData submodule: Provided functionName is not a function or not accessible') - } - return data; - }, - /** - * performs action to obtain id - * @function - * @returns {string} - */ - getId(data) { - // If the page includes its own pubcid object, then use that instead. - var dta; - if (data && (typeof data.cookieName == 'string' || typeof data.functionName == 'string' || data.functionName != '')) { - try { - if (data.functionName) { - dta = this.getDataFromFunction(data.functionName) - } else if (data.cookieName) { - dta = this.getDataFromCookieName(data.cookieName); - } - } catch (e) {} - return dta; - } - utils.logError('User ID - customData submodule requires either data or cookie name to be defined'); - } -}; - -submodule('userId', customIdSubmodule); diff --git a/modules/id5IdSystem.js b/modules/id5IdSystem.js index 0dc71b92d9a..7ed1fdf6bf3 100644 --- a/modules/id5IdSystem.js +++ b/modules/id5IdSystem.js @@ -33,13 +33,7 @@ export const id5IdSubmodule = { * @returns {function(callback:function)} */ getId(configParams, consentData) { - if (configParams) { - configParams.partner = parseInt(configParams.partner); - if (typeof configParams.partner !== 'number') { - utils.logError(`User ID - ID5 submodule requires partner to be defined as a number`); - return; - } - } else { + if (!configParams || typeof configParams.partner !== 'number') { utils.logError(`User ID - ID5 submodule requires partner to be defined as a number`); return; } diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index 8f5673644e2..980c59b51ce 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -634,34 +634,10 @@ function _handleTTDId(eids, validBidRequests) { } } -/** - * 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`), 'pubcommon', 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.criteortus.${BIDDER_CODE}.userid`), 'criteortus', 1); - _addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1); - _addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.customData`), 'customData', 1); - } if (eids.length > 0) { payload.user.eids = eids; } @@ -965,7 +941,7 @@ export const spec = { netRevenue: NET_REVENUE, cpm: 0, currency: respCur, - referrer: parsedReferrer, + referrer: requestData.site && requestData.site.ref ? requestData.site.ref : '', }) }); } @@ -987,7 +963,7 @@ export const spec = { br.currency = respCur; br.netRevenue = NET_REVENUE; br.ttl = 300; - br.referrer = parsedReferrer; + br.referrer = requestData.site && requestData.site.ref ? requestData.site.ref : ''; br.ad = bid.adm; if (requestData.imp && requestData.imp.length > 0) { requestData.imp.forEach(req => { diff --git a/modules/pubmaticServerBidAdapter.js b/modules/pubmaticServerBidAdapter.js index aa9745de807..2ed71e0e4e1 100644 --- a/modules/pubmaticServerBidAdapter.js +++ b/modules/pubmaticServerBidAdapter.js @@ -1,9 +1,9 @@ -import * as utils from '../src/utils'; -import * as ajax from '../src/ajax'; -import {userSync} from '../src/userSync'; -import { config } from '../src/config'; -import { registerBidder } from '../src/adapters/bidderFactory'; -const constants = require('../src/constants.json'); +import * as utils from 'src/utils'; +import * as ajax from 'src/ajax'; +import {userSync} from 'src/userSync'; +import { config } from 'src/config'; +import { registerBidder } from 'src/adapters/bidderFactory'; +const constants = require('src/constants.json'); const BIDDER_CODE = 'pubmaticServer'; const ENDPOINT = '//ow.pubmatic.com/openrtb/2.5/'; diff --git a/modules/userId/index.js b/modules/userId/index.js index 6fe090f1a08..98d99f7d333 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -76,9 +76,8 @@ import {getGlobal} from '../../src/prebidGlobal'; import {gdprDataHandler} from '../../src/adapterManager'; import CONSTANTS from '../../src/constants.json'; import {module} from '../../src/hook'; -// import {unifiedIdSubmodule} from './unifiedIdSystem.js'; +import {unifiedIdSubmodule} from './unifiedIdSystem.js'; import {pubCommonIdSubmodule} from './pubCommonIdSystem.js'; -// import {customIdSubmodule} from './customIdSystem.js'; const MODULE_NAME = 'User ID'; const COOKIE = 'cookie'; @@ -250,8 +249,8 @@ function initializeSubmodulesAndExecuteCallbacks() { if (submodulesWithCallbacks.length) { // wait for auction complete before processing submodule callbacks - events.on(CONSTANTS.EVENTS.REQUEST_BIDS, function auctionEndHandler() { - events.off(CONSTANTS.EVENTS.REQUEST_BIDS, auctionEndHandler); + events.on(CONSTANTS.EVENTS.AUCTION_END, function auctionEndHandler() { + events.off(CONSTANTS.EVENTS.AUCTION_END, auctionEndHandler); // when syncDelay is zero, process callbacks now, otherwise dealy process with a setTimeout if (syncDelay > 0) { @@ -467,7 +466,6 @@ init(config); // add submodules after init has been called attachIdSystem(pubCommonIdSubmodule); -// attachIdSystem(unifiedIdSubmodule); -// attachIdSystem(customIdSubmodule); +attachIdSystem(unifiedIdSubmodule); module('userId', attachIdSystem); diff --git a/modules/unifiedIdSystem.js b/modules/userId/unifiedIdSystem.js similarity index 91% rename from modules/unifiedIdSystem.js rename to modules/userId/unifiedIdSystem.js index c47e1d0b5ac..1bc369bb9fc 100644 --- a/modules/unifiedIdSystem.js +++ b/modules/userId/unifiedIdSystem.js @@ -5,9 +5,8 @@ * @requires module:modules/userId */ -import * as utils from '../src/utils' -import {ajax} from '../src/ajax'; -import {submodule} from '../src/hook'; +import * as utils from '../../src/utils' +import {ajax} from '../../src/ajax'; /** @type {Submodule} */ export const unifiedIdSubmodule = { @@ -54,5 +53,3 @@ export const unifiedIdSubmodule = { } } }; - -submodule('userId', unifiedIdSubmodule); diff --git a/test/spec/modules/appierAnalyticsAdapter_spec.js b/test/spec/modules/appierAnalyticsAdapter_spec.js index f8c434967f7..07b9796a4cb 100644 --- a/test/spec/modules/appierAnalyticsAdapter_spec.js +++ b/test/spec/modules/appierAnalyticsAdapter_spec.js @@ -608,7 +608,7 @@ describe('Appier Prebid AnalyticsAdapter Testing', function () { sinon.stub(appierAnalyticsAdapter, 'createBidMessage').returns({}); sinon.spy(appierAnalyticsAdapter, 'createCreativeMessage'); events.emit(constants.EVENTS.AUCTION_END, args); - // sinon.assert.callCount(appierAnalyticsAdapter.createCreativeMessage, 1); + sinon.assert.callCount(appierAnalyticsAdapter.createCreativeMessage, 1); appierAnalyticsAdapter.sendEventMessage.restore(); appierAnalyticsAdapter.createBidMessage.restore(); appierAnalyticsAdapter.createCreativeMessage.restore(); diff --git a/test/spec/modules/userId_spec.js b/test/spec/modules/userId_spec.js index fa1a66948fa..13f35b68545 100644 --- a/test/spec/modules/userId_spec.js +++ b/test/spec/modules/userId_spec.js @@ -7,7 +7,7 @@ import { } from 'modules/userId/index.js'; import {config} from 'src/config'; import * as utils from 'src/utils'; -import {unifiedIdSubmodule} from 'modules/unifiedIdSystem'; +import {unifiedIdSubmodule} from 'modules/userId/unifiedIdSystem'; import {pubCommonIdSubmodule} from 'modules/userId/pubCommonIdSystem'; import {id5IdSubmodule} from 'modules/id5IdSystem'; import {identityLinkSubmodule} from 'modules/identityLinkIdSystem'; diff --git a/test/spec/unit/core/targeting_spec.js b/test/spec/unit/core/targeting_spec.js index e9140d93810..b165a2a21fb 100644 --- a/test/spec/unit/core/targeting_spec.js +++ b/test/spec/unit/core/targeting_spec.js @@ -467,7 +467,7 @@ describe('targeting tests', function () { expect(targeting['/123456/header-bid-tag-0'][CONSTANTS.TARGETING_KEYS.PRICE_BUCKET + '_rubicon']).to.deep.equal(targeting['/123456/header-bid-tag-0'][CONSTANTS.TARGETING_KEYS.PRICE_BUCKET]); }); - xit('ensures keys are properly generated when enableSendAllBids is true and multiple bidders use native', function() { + it('ensures keys are properly generated when enableSendAllBids is true and multiple bidders use native', function() { const nativeAdUnitCode = '/19968336/prebid_native_example_1'; enableSendAllBids = true; @@ -480,7 +480,7 @@ describe('targeting tests', function () { }); let targeting = targetingInstance.getAllTargeting([nativeAdUnitCode]); - // expect(targeting[nativeAdUnitCode].hb_native_image).to.equal(nativeBid1.native.image.url); + expect(targeting[nativeAdUnitCode].hb_native_image).to.equal(nativeBid1.native.image.url); expect(targeting[nativeAdUnitCode].hb_native_linkurl).to.equal(nativeBid1.native.clickUrl); expect(targeting[nativeAdUnitCode].hb_native_title).to.equal(nativeBid1.native.title); expect(targeting[nativeAdUnitCode].hb_native_image_dgad).to.exist.and.to.equal(nativeBid2.native.image.url);