How to take part in the FLoC origin trial

Federated Learning of Cohorts (FLoC) provides a privacy-preserving mechanism for interest-based ad selection. As a user moves around the web, their browser uses the FLoC algorithm to work out its "interest cohort", which will be the same for thousands of browsers with a similar recent browsing history. The user's browser is associated with one interest cohort at a time and recalculates its cohort periodically (currently once every seven days during this initial origin trial) on the user's device, without sharing individual browsing data with the browser vendor or anyone else.

To find out more about FLoC, see What is Federated Learning of Cohorts?.

Take part in a FLoC origin trial

An origin trial for FLoC started in Chrome 89, and has been made available as a third-party origin trial.

To take part, you will need to register for a FLoC origin trial token.

First-party context

To access interest cohort data on your own site(s), add the origin trial token to your web pages, using one of the following methods:

  • As a meta tag in the <head> of each page served:

    <meta http-equiv="origin-trial" content="TOKEN_GOES_HERE">

  • As an HTTP header:

    Origin-Trial: TOKEN_GOES_HERE

With this in place, you can try out FLoC in a first-party context: for example, to observe cohorts for visitors to your site(s).

Third-party context

You will need to inject the origin trial token in a meta tag in order to test the FLoC API in your code on third-party sites. Origin Trials Guide for Web Developers explains how to do this.

Submit feedback

Do this through Chrome's origin trial site. This feedback is not public and is available only to a limited group of people on the Chrome team. When your token expires, you will get an email with a renewal link. Before renewing the token, you are again asked to submit feedback.

Try out FLoC as a web developer

There are two ways to try out FLoC:

  • Enable FLoC for your browser by setting browser flags.
  • Use a browser that is included in the origin trial.

Enable FLoC with browser flags

The FLoC API is very simple: just a single method that returns a promise which resolves to an object providing the cohort id and version:

document.interestCohort()

The cohort data made available looks like this:

{
  "id": "14159",
  "version": "chrome.2.1"
}

The FLoC API is available in Chrome 89 and above, but if your browser is not included in the origin trial, you will need to run Chrome with flags in order to try out the API. Run Chromium with flags explains how to do this for different operating systems.

  1. Start Chrome with the following flags. Make sure to copy all the text!

    --enable-blink-features=InterestCohortAPI
    --enable-features="FederatedLearningOfCohorts:update_interval/10s/minimum_history_domain_size_required/1,FlocIdSortingLshBasedComputation,InterestCohortFeaturePolicy"
    


    The FlocPagesWithAdResourcesDefaultIncludedInFlocComputation flag can also be included, to re-create the FLoC algorithm from the initial origin trial (the default value otherwise is false).


  2. Check that third-party cookies are not blocked and that no ad blocker is running.

  3. View the demo at floc.glitch.me or run the following code from the DevTools console:

    await document.interestCohort()
    

What do the experimental flags mean?

  • InterestCohortAPI enables FLoC.
  • update_interval/10s sets the cohort to be recalculated every 10 seconds. This is only to enable testing; the cohort recalculation interval currently defaults otherwise to every seven days.
  • minimum_history_domain_size_required/1 specifies the minimum number of domains that must be available in order for the cohort to be computed. The value here is for testing only and normally would be higher.
  • FlocIdSortingLshBasedComputation sets the clustering algorithm used by FLoC.
  • InterestCohortFeaturePolicy enables the availability of the Permissions-Policy header for FLoC.
  • It is also possible to set the FLoC version by using a value such as "FederatedLearningOfCohorts:finch_config_version/2".

You can view FLoC flag code in Chromium Code Search.

Check if your browser is included in the origin trial

During the origin trial, FLoC is enabled by default for a small percentage of browsers. For these browsers, the FLoC API is made available without requiring flags to be set. You can check if your browser is included in the trial by trying out one of the two demos below. Each of these uses a different method to provide an origin trial token.

Try out FLoC as a publisher, advertiser or adtech platform

The FLoC API explainer suggests use cases, but does not define how the API should be used. Different sites and services will have different constraints and requirements for using FLoC to provide relevant content and ads.

If you manage your own technology for content recommendations, advertising or marketing services then you could apply your FLoC insights to tailor content or marketing messages to specific cohorts. If you rely on third party companies to provide these services then it might make more sense for them to join the origin trial and run experiments including your site and other sites.

As an example, for a publisher finding ways to select relevant content, the process of trying out FLoC during the origin trial might work something like this:

  1. Collect data about site usage and cohort IDs.
  2. Analyze the data for correlations. Use the data to select relevant content.
  3. Compare the FLoC approach against other mechanisms. Did it work the way you expect it?
  4. Adjust the use of FLoC to select content.
  5. Provide origin trial feedback.
  6. Repeat.

How can websites opt out of the FLoC computation?

A site should be able to declare that it does not want to be included in the user's list of sites for cohort calculation. A new interest-cohort permissions policy enables this. The policy will be allow by default.

For any frame that is not allowed interest-cohort permission, the promise returned when it calls document.interestCohort() will reject. If the main frame does not have interest-cohort permission then the page visit will not be included in interest cohort calculation.

For example, a site can opt out of all FLoC cohort calculation by sending the HTTP response header:

Permissions-Policy: interest-cohort=()

During the FLoC origin trial, pages on websites that don't opt out will be included in the FLoC calculation if Chrome detects that they load ads-related resources or if they use document.interestCohort(). Pages served from private IP addresses, such as intranet pages, won't be part of the FLoC computation.

Origin trials give developers a chance to see what a new API proposal would be like if it were launched. For FLoC, how can we enable the API to be evaluated realistically before it has wide adoption? For the small-scale origin trial experiment, Chrome chose to make the assumption that every page which uses ads would use FLoC. This is unlikely to be completely realistic, but is the most plausible heuristic available.

Find out more


Photo by Rhys Kentish on Unsplash.