With third-party cookies becoming less prevalent Google has introduce a new form of tracking called Federated Learning of Cohorts, or FLoC. Google has suggested that this alternative to cookies will better positioned to protect user data.

If you want to disable FLoC in your ASP.NET Core app you can put the following code in your Configure() method in Startup.cs as follows:

app.Use((context, next) =>
{
    context.Response.Add("Permissions-Policy", "interest-cohort=()");
    return next.Invoke();
});

Now this code should be near the top of your middleware pipeline, more specifically before app.UseMVC() and/or app.UseEndpoints(). For DasBlog I already have permission header policy so I will bundle this info there.

You might also make the decision to forgo this header completely if you have no JavaScript that calls document.interestCohort() (be sure to check your 3rd party scripts though).

Gravity Columbus Ohio building facade


Share on Twitter Facebook

Comment Section