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

UserID Module: allow userid to ppid sync #6448

Closed
wants to merge 16 commits into from
11 changes: 11 additions & 0 deletions modules/userId/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
*/

import find from 'core-js-pure/features/array/find.js';
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';
Expand Down Expand Up @@ -820,6 +821,16 @@ 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, how/where would the publisher define the value for userSync.ppid?
Also, my understanding from this comment is that it will leave the choice to the publisher onto which ID from EIDS they choose to use as PPID: do you confirm?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FlorentDancy

The pub will need to set ppid inside of their userSync setConfig.

Something like so:

      config.setConfig({
        userSync: {
          ppid: 'pubcid.org',
          userIds: [
            .. userIds
          ]
        }
      });

where the pubcid.org matches the userId submodules associated eids source value defined in eids.js

This PR has been closed as another one was open to fix the tests etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clear, thanks @robertrmartinez!

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') {
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) {
smenzer marked this conversation as resolved.
Show resolved Hide resolved
window.googletag.cmd.push(function() {
window.googletag.pubads().setPublisherProvidedId(ppid)
});
}
}
});

// exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes.
Expand Down