Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Support FLoC cohort IDs (trial & release)

Open Viewtiful opened this issue 5 years ago • 47 comments

Type of issue

Questions

Description

Following the start of the trial of the FLoC feature linked to the privacy sandbox project, we would like to start to receive cohort IDs from our adapter.

  1. Do you plan to support a solution for this trial period?
  2. If we introduce a logic to retrieve the cohort IDs from our adapter for the trial period, do you see any issues doing so? Example of a possible logic (partial pseudo code):

Programmatically inject the token for the trials:

function activateInterestCohortFeature() {
  const tokenElement = document.createElement('meta')
  tokenElement.httpEquiv = 'origin-trial'
  tokenElement.content = 'TOKEN'
  document.head.appendChild(tokenElement)
}

If in a chrome browser and interest-cohort feature is available, retrieve it and then send it in the bid requests constructed in the adapter:

const isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
if (isChrome && !!document.featurePolicy && !!document.featurePolicy.features() && document.featurePolicy.features().includes('interest-cohort')) {
  return await document.interestCohort() || {};
}
  1. Is there a longer term plan for the support of FLoC and cohort IDs prebid side?

Viewtiful avatar Apr 01 '21 13:04 Viewtiful

Injecting the token is a concern, we're injecting our own token. Multiple tokens could have unexpected behavior.

This seems better as an rtd submodule than part of a bidder. [update - id submodule seems even better than rtd submodule ]

patmmccann avatar Apr 01 '21 14:04 patmmccann

@jdwieland8282 and I were discussing this. I'd like to suggest a slightly different implementation for the Origin period:

  • Register sharedid.org (or another prebid.org operated domain) as a "Third Party Matching" origin on https://developer.chrome.com/origintrials/#/register_trial/213920982300098561
  • Create a new module for "FLoC Origin Support"
  • Support collection of FLoC IDs when this module is included via dropping 3P JS (from sharedid.org) or an iframe.
  • The available FLoC ID could be treated as a pseudo userID (cached locally for a limited TTL, provided in the eid array, made available to bidders) for maximum compatibility:
"userIdAsEids": [
    {
      "source": "web.dev",
      "uids": [
        {
          "id": "3258",
          "atype": 1,
        }
      ]
    }
  ],

Alternatively, this could be made available in fpd or an alternative data payload.

Unfortunately, it seems like the rules of the 3P matching require injecting 3P JS or an iframe. But by supporting a standard module, it should be easier for publishers and bidders alike to participate in the trial at scale in a less error-prone process by operating against a single 3P origin token.

ian-lr avatar Apr 01 '21 16:04 ian-lr

I would prefer an implementation that allowed publishers to drop their own token, but happy if it defaults to sharedid.org token.

I like @ian-lr 's suggestion of this being an id submodule instead of an rtd submodule, as id submodules are really just special types of data modules with a lot more stringent rules limiting their scope. I think it makes sense for all those extra rules to apply here.

patmmccann avatar Apr 01 '21 17:04 patmmccann

Added a question on the FLoC repo: https://github.com/WICG/floc/issues/88

(Chrome is just using the token to check whether or not the page should be in the origin trial, so it should turn it on when it sees the first valid token and ignore the rest -- should not matter which token gets used. But it would be good to have someone from Chrome confirm this.)

dmarti avatar Apr 01 '21 17:04 dmarti

So maybe accept an optional token parameter to instantiate the module:

pbjs.setConfig({
    userSync: {
        userIds: [{
            name: "originFloc",
            params: {
              token: "3JsY2RuLmNvbTo0NDMiLCJmZW..."
            },
            storage: {
              type: "html5",
              name: "originFlocCache",
              expires: 1
            }
        }]
    }
})

@patmmccann would the need (if running on sharedid.org tokens) to drop 3P JS be an argument against an id module?

ian-lr avatar Apr 01 '21 17:04 ian-lr

Update: Multiple tokens will work the way that we thought. ("Only one valid token is required to enable a trial, any other invalid tokens or non-matching tokens are ignored.") It is fine for more than one script on a page to inject the meta element.

dmarti avatar Apr 01 '21 18:04 dmarti

That's great news. Since multiple tokens are harmless, my concerns above are moot

patmmccann avatar Apr 01 '21 20:04 patmmccann

I am not very sure if FloC qualifies as an eid rather I recommend passing it as user segment.

Few points and feedback:

  1. I understand and agree to use the existing eids for origin trial where its easier to implement and adopt in existing flow
  2. We should push for adoption of floc id under user.data.segment as it essentially represents a group of users
  3. I can definitely see segments fit better with future use cases like running deals directly on floc Ids rather than adding custom logic for specific eids (I am talking from SSP perspective here)
  4. FloC algorithm / version is also key data point to ensure the analysis is not impacted by changes to algo so either append the version in ID string or pass is separately.
  5. In short term we can internally populate the oRTB user.data.segment of fpd as well as user.ext.eids with floc id and gradually deprecate this from eids after origin trials.

We have suggested Google OB team to use segments and keep it consistent across integrations , awaiting decision and some IAB standard for this as well.

Proposed oRTB structure user.data.segment & user.ext.eids format:

"user": {
  "data": [
    {
      "name": "chrome.com",
      "ext": {
        "ver": "chrome.1.1"
      },
      "segment": [
        {
          "id": "777454319066618"
        }
      ]
    }
  ],
  "ext": {
    "eids": [
      {
        "source": "chrome.com",
        "uids": [
          {
            "id": "777454319066618",
            "atype": 1,
            "ext": {
              "ver": "chrome.1.1"
            }
          }
        ]
      }
    ]
  }
}

abhinavsinha001 avatar Apr 05 '21 08:04 abhinavsinha001

@abhinavsinha001 the id modules can only populate eids. If you are advocating it end up in both places, we'll need some functionality in a different place. Do you have any concerns with @SKOCHERI 's PR going forward with eid's and then a followup pr could replicate the data into the other place?

patmmccann avatar Apr 06 '21 14:04 patmmccann

@SKOCHERI 's PR need not be blocked, we can make the necessary change to replicate the data in a follow-up PR.

pm-harshad-mane avatar Apr 06 '21 16:04 pm-harshad-mane

We brought this up at the IAB 2.6 meeting today, and it seemed consensus was leaning towards keeping it in eids, as it is 'an identifier with no inherent meaning' despite not being unique to an individual.

patmmccann avatar Apr 06 '21 17:04 patmmccann

👍 Thanks a lot everyone for looking at this issue ! Indeed, using a new ID module makes more sense instead of a custom solution in each adapters that want to opt-in during the trial and I also agree that it makes more sense as an eid.

One thing I am not sure, I could not find any documentation about it, if we can actually use a shared token set in the module to activate the trial features

Viewtiful avatar Apr 06 '21 17:04 Viewtiful

Thank you @patmmccann for sharing the IAB meeting note.

pm-harshad-mane avatar Apr 06 '21 17:04 pm-harshad-mane

@patmmccann @abhinavsinha001 @ian-lr good points. For my 2 cents:

  • The first implementation is the one we'll have to live with.
  • Please don't send the same data in two places.
  • To Patrick's point, eids is appropriate if this is 'an identifier with no inherent meaning' -- I would add, if it is relatively transient, so e.g., it would not be considered targetable.
  • To Abhinav's point, segments is appropriate if this is a relatively persistent (and targetable) value that (obviously) represents a group of people.

simontrasler avatar Apr 06 '21 17:04 simontrasler

If the segment camp wins out, I would recommend moving this functionality from a userid submodule to https://github.com/prebid/Prebid.js/pull/6452

patmmccann avatar Apr 06 '21 17:04 patmmccann

Agree for this phase and analysing data let's proceed with eids but I would recommend adding support for floc ID version. I am guessing the floc version and also will change frequently at least during the origin trial phase. @SKOCHERI can we add that to the PR ?

abhinavsinha001 avatar Apr 06 '21 17:04 abhinavsinha001

(One more observation to my comment above, it's possible that the expected treatment of segments vs eids differ -- e.g., it's expected that eids are public and can be propagated all the way down the chain, whereas it may be expected that segments are private to the two parties in direct communication. If so, that would be a reason to use eids.)

simontrasler avatar Apr 06 '21 18:04 simontrasler

@SKOCHERI is OOO this week, if anyone else would like to make the proposed changes that would be really helpful.

jdwieland8282 avatar Apr 06 '21 18:04 jdwieland8282

this may be a really dumb question, but what is it exactly that is supposed to be sent through the bid adapters as the cohort ids? is it just the token? the implementation as it stands today is simply taking the token from the config and setting that as the "floc id", but there's discussion about not making the token mandatory because it's temporary. i guess i just don't see where any JS is being executed to pick up the interest cohorts like was in the pseudo code from this original issue

smenzer avatar Apr 07 '21 07:04 smenzer

@smenzer is correct that the pr is a wip, however, i am sure that will be fixed soon

The floc id is not the token, it is an integer that one can get with a browser api call document.getInterestCohort()

Details here https://github.com/WICG/floc

patmmccann avatar Apr 07 '21 13:04 patmmccann