Google FLoC and how to opt out app-wise

Probably most of you already heard about FLoC. If not - you can find plenty articles about it, here is a sample:

Anyway, I think it’s bad. So if you are like me in that matter (and like Symfony, and Github, and Wordpress, and many more…), you want to block this in your Yii 2 app. Here is one of the ways.

Add this in the web components configuration (usually /config/web.php):

[
    // ... other configuration
    'components' => [
        // ... other components configuration
        'response' => [
            'on beforeSend' => function () {
                Yii::$app->response->headers->add('permissions-policy', 'interest-cohort=()');
            }
        ],
    ],
]
3 Likes

This is somehow pointless:

  1. very soon Google will start “accidentally” ignoring it, just like everyone ignores DoNotTrack header.
  2. This command just excludes your site from FLoC calculations, it doesn’t block access to already calculated value.
    So the right way dig out IE-era banners “Your browser is insecure, use any other” and help your visitors migrate.

It’s not pointless. Or rather - if it is, then in one way or another - everything is.
This helps. But I agree with one thing. Do not use Chrome.

2 Likes