Skip to content

UserId module: allow to configure a transformation for the ppid #15385

Description

@robin-crazygames

The user id module allows to configure to use an identity provider as ppid for GAM using the ppid property:

function getPPID(eids = getUserIdsAsEids() || []) {
  // userSync.ppid should be one of the 'source' values in getUserIdsAsEids() eg pubcid.org or id5-sync.com
  const matchingUserId = ppidSource && eids.find(userID => userID.source === ppidSource);
  if (matchingUserId && typeof matchingUserId?.uids?.[0]?.id === 'string') {
    const ppidValue = matchingUserId.uids[0].id.replace(/[\W_]/g, '');
    if (ppidValue.length >= 32 && ppidValue.length <= 150) {
      return ppidValue;
    } else {
      logWarn(`User ID - Googletag Publisher Provided ID for ${ppidSource} is not between 32 and 150 characters - ${ppidValue}`);
    }
  }
}

There is already some replacing going on to fulfill the GAM requirements for ppid:

    const ppidValue = matchingUserId.uids[0].id.replace(/[\W_]/g, '');

However, most of the ids will still fail the length check, and hence cannot and will not be used as ppid.

It also means that, even if you choose a user id provider that uses a short id, the user id provider might upgrade/change their id in the future and suddenly you're no longer sending a ppid to GAM.

Not sure what the best solution is (hence why I open an issue and not a PR):

  • Have a configuration option to specify a transformation function, where the default would be the current replacement function. That way, I can for example specify to use a sha256 hashing function where I know the result will always fulfill the GAM requirements.
  • Instead of specifying a full transformation function, just allow to choose from some defaults (trim, sha256, replace)?
  • Something else I haven't thought of yet

The reason I want to do it through Prebid and not just set the ppid myself is that Prebid contains check on whether the user allowed enrichment. Otherwise I would have to duplicate those checks.

I'm willing to create the PR for this. Just need some guidance on what the preferred approach would be (if you think this issue is worth fixing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Ready for Dev

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions