From 31606b8d69ffbc28539a2210c0b574e4917c7878 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 11:41:39 -0400 Subject: [PATCH 01/16] Update index.js --- modules/userId/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/userId/index.js b/modules/userId/index.js index 3253be42a76..bf6beda18fc 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -820,6 +820,13 @@ export function init(config) { auctionDelay = utils.isNumber(userSync.auctionDelay) ? userSync.auctionDelay : NO_AUCTION_DELAY; updateSubmodules(); } + if (userSync && userSync.userIds && getUserIds().hasOwnProperty(userSync.ppid) && typeof getUserIds()[userSync.ppid] === 'string') { + let googletag = window.googletag || {}; + googletag.cmd = googletag.cmd || []; + googletag.cmd.push(function() { + googletag.pubads().setPublisherProvidedId(getUserIds()[userSync.ppid]) + }); + } }); // exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes. From ae810a17eeb2254d32fcfd4486b788b54d3de29e Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 11:44:48 -0400 Subject: [PATCH 02/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index bf6beda18fc..fdef7f80858 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -820,7 +820,7 @@ export function init(config) { auctionDelay = utils.isNumber(userSync.auctionDelay) ? userSync.auctionDelay : NO_AUCTION_DELAY; updateSubmodules(); } - if (userSync && userSync.userIds && getUserIds().hasOwnProperty(userSync.ppid) && typeof getUserIds()[userSync.ppid] === 'string') { + if (userSync && userSync.userIds && userSync.ppid && getUserIds().hasOwnProperty(userSync.ppid) && typeof getUserIds()[userSync.ppid] === 'string') { let googletag = window.googletag || {}; googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { From 2678d89c1ccaa3255537f5ef061fb445fa7f3100 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 12:46:55 -0400 Subject: [PATCH 03/16] Update index.js --- modules/userId/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index fdef7f80858..2ee08bf27a2 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -130,6 +130,7 @@ */ import find from 'core-js-pure/features/array/find.js'; +import findIndex from 'core-js-pure/features/array/virtual/find-index'; import { config } from '../../src/config.js'; import events from '../../src/events.js'; import * as utils from '../../src/utils.js'; @@ -820,11 +821,12 @@ export function init(config) { auctionDelay = utils.isNumber(userSync.auctionDelay) ? userSync.auctionDelay : NO_AUCTION_DELAY; updateSubmodules(); } - if (userSync && userSync.userIds && userSync.ppid && getUserIds().hasOwnProperty(userSync.ppid) && typeof getUserIds()[userSync.ppid] === 'string') { + //userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com + if (userSync && userSync.userIds && userSync.ppid && getUserIdsAsEids().findIndex(x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { - googletag.pubads().setPublisherProvidedId(getUserIds()[userSync.ppid]) + googletag.pubads().setPublisherProvidedId(getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id) }); } }); From 865ffa01c61b3c72a5c635bd06213746e1a95e38 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 12:53:52 -0400 Subject: [PATCH 04/16] Update index.js --- modules/userId/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 2ee08bf27a2..2d3b0ffff06 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -125,12 +125,12 @@ */ /** - * @typedef {Object} RefreshUserIdsOptions + * @typedef {Object} RefreshUserIdsOpnpmjs.com/package/ctions * @property {(string[]|undefined)} submoduleNames - submodules to refresh */ import find from 'core-js-pure/features/array/find.js'; -import findIndex from 'core-js-pure/features/array/virtual/find-index'; +import findIndex from 'core-js-pure/features/array/find-index'; import { config } from '../../src/config.js'; import events from '../../src/events.js'; import * as utils from '../../src/utils.js'; @@ -821,7 +821,7 @@ export function init(config) { auctionDelay = utils.isNumber(userSync.auctionDelay) ? userSync.auctionDelay : NO_AUCTION_DELAY; updateSubmodules(); } - //userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com + // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com if (userSync && userSync.userIds && userSync.ppid && getUserIdsAsEids().findIndex(x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; googletag.cmd = googletag.cmd || []; From 58e7a3098ada6fab4b17191560b9ec02edf786e4 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 12:55:40 -0400 Subject: [PATCH 05/16] Update index.js --- modules/userId/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 2d3b0ffff06..22e39a4a8f6 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -125,12 +125,12 @@ */ /** - * @typedef {Object} RefreshUserIdsOpnpmjs.com/package/ctions + * @typedef {Object} RefreshUserIdsOptions * @property {(string[]|undefined)} submoduleNames - submodules to refresh */ import find from 'core-js-pure/features/array/find.js'; -import findIndex from 'core-js-pure/features/array/find-index'; +import findIndex from 'core-js-pure/features/array/find-index.js'; import { config } from '../../src/config.js'; import events from '../../src/events.js'; import * as utils from '../../src/utils.js'; From af1c4f6a5edf8e83be45aee0c4bde9a6b3a7dc99 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:10:07 -0400 Subject: [PATCH 06/16] Update index.js --- modules/userId/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 22e39a4a8f6..a53dcdba253 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -12,7 +12,7 @@ * @summary performs action to obtain id and return a value in the callback's response argument. * If IdResponse#id is defined, then it will be written to the current active storage. * If IdResponse#callback is defined, then it'll called at the end of auction. - * It's permissible to return neither, one, or both fields. + * It's permissible to return neither, one, or both fields.'findIndex' is defined but never used * @name Submodule#getId * @param {SubmoduleConfig} config * @param {ConsentData|undefined} consentData @@ -822,7 +822,7 @@ export function init(config) { updateSubmodules(); } // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com - if (userSync && userSync.userIds && userSync.ppid && getUserIdsAsEids().findIndex(x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { + if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { From 7f37b1c17672f81d33e03be8b6bdd2b0d0c3ffcf Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:12:36 -0400 Subject: [PATCH 07/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index a53dcdba253..edd5ebeaf32 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -12,7 +12,7 @@ * @summary performs action to obtain id and return a value in the callback's response argument. * If IdResponse#id is defined, then it will be written to the current active storage. * If IdResponse#callback is defined, then it'll called at the end of auction. - * It's permissible to return neither, one, or both fields.'findIndex' is defined but never used + * It's permissible to return neither, one, or both fields. * @name Submodule#getId * @param {SubmoduleConfig} config * @param {ConsentData|undefined} consentData From 6cc9c5befb942196b870316f52b132d99d34301c Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:24:13 -0400 Subject: [PATCH 08/16] Update index.js --- modules/userId/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index edd5ebeaf32..37c6a31fbb4 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -824,10 +824,13 @@ export function init(config) { // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; - googletag.cmd = googletag.cmd || []; - googletag.cmd.push(function() { - googletag.pubads().setPublisherProvidedId(getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id) - }); + let ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, '') || {}; + if(typeOf ppid === 'string' && ppid.length >= 32 && ppid.length<= 150 { + googletag.cmd = googletag.cmd || []; + googletag.cmd.push(function() { + googletag.pubads().setPublisherProvidedId() + }); + } } }); From 72fa054bf53f276f5524bb2ef330fa4fd62ab4b0 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:27:12 -0400 Subject: [PATCH 09/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 37c6a31fbb4..caee6b63280 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -824,7 +824,7 @@ export function init(config) { // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; - let ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, '') || {}; + const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); if(typeOf ppid === 'string' && ppid.length >= 32 && ppid.length<= 150 { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { From 7ecaf60157fc7a19a0d3c3d49ea066e2a6e8861d Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:31:50 -0400 Subject: [PATCH 10/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index caee6b63280..8252fe74ebd 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -825,7 +825,7 @@ export function init(config) { if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); - if(typeOf ppid === 'string' && ppid.length >= 32 && ppid.length<= 150 { + if(typeOf ppid === 'string' && ppid.length >= 32 && ppid.length<= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { googletag.pubads().setPublisherProvidedId() From 691a5a585ebc8cc90690f8af335a74e044de0705 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:34:51 -0400 Subject: [PATCH 11/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 8252fe74ebd..f214744af81 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -825,7 +825,7 @@ export function init(config) { if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); - if(typeOf ppid === 'string' && ppid.length >= 32 && ppid.length<= 150) { + if(ppid.length >= 32 && ppid.length<= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { googletag.pubads().setPublisherProvidedId() From 1a7ebfdd761feef73fd21c0e1b6303fa8c4808c5 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:36:43 -0400 Subject: [PATCH 12/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index f214744af81..ff7eed1d3bd 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -825,7 +825,7 @@ export function init(config) { if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); - if(ppid.length >= 32 && ppid.length<= 150) { + if (ppid.length >= 32 && ppid.length<= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { googletag.pubads().setPublisherProvidedId() From c6bf4af8d577ea53e70ac4a4825a3dd44fbad90c Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:38:01 -0400 Subject: [PATCH 13/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index ff7eed1d3bd..1fe036a1e9c 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -828,7 +828,7 @@ export function init(config) { if (ppid.length >= 32 && ppid.length<= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { - googletag.pubads().setPublisherProvidedId() + googletag.pubads().setPublisherProvidedId(ppid) }); } } From 9bac55eba5de813805745ecfa6a4c6af9f5a3d85 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 13:39:14 -0400 Subject: [PATCH 14/16] Update index.js --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 1fe036a1e9c..06d5fe7ebaa 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -825,7 +825,7 @@ export function init(config) { if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); - if (ppid.length >= 32 && ppid.length<= 150) { + if (ppid.length >= 32 && ppid.length <= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { googletag.pubads().setPublisherProvidedId(ppid) From e2f68b3df2bb4ad0c516a7fc1beb786ceb947885 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Fri, 19 Mar 2021 14:32:48 -0400 Subject: [PATCH 15/16] get rid of _ in ppid --- modules/userId/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 06d5fe7ebaa..22c6c68ede7 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -824,7 +824,7 @@ export function init(config) { // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { let googletag = window.googletag || {}; - const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/\W/g, ''); + const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/[\W_]/g, ''); if (ppid.length >= 32 && ppid.length <= 150) { googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { From 6b01eabfb48d904e094a630a65979142d69b5dea Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Mon, 22 Mar 2021 13:10:06 -0400 Subject: [PATCH 16/16] Update index.js --- modules/userId/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 22c6c68ede7..64709d4aad6 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -823,12 +823,11 @@ export function init(config) { } // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com if (userSync && userSync.userIds && userSync.ppid && findIndex(getUserIdsAsEids(), x => x.source === userSync.ppid) >= 0 && typeof getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id === 'string') { - let googletag = window.googletag || {}; + window.googletag = window.googletag || { cmd: [] }; const ppid = getUserIdsAsEids().find(x => x.source === userSync.ppid).uids[0].id.replace(/[\W_]/g, ''); if (ppid.length >= 32 && ppid.length <= 150) { - googletag.cmd = googletag.cmd || []; - googletag.cmd.push(function() { - googletag.pubads().setPublisherProvidedId(ppid) + window.googletag.cmd.push(function() { + window.googletag.pubads().setPublisherProvidedId(ppid) }); } }