V for Vendetta-style Guy Fawes masks

image by Ahmed Zayan

Opt out of Google’s FLoC User Tracking in Rails

Google has recently built user tracking directly into Chrome. This new technology is named Federated Learning of Cohorts (shortened to FLoC).

RailsConf 2024

I'm co-chairing RailsConf 2024 in Detroit May 7–9. Come and join us 

Instead of…

doing nothing…


…a custom response header to opt your application, and thus your users, out of this user tracking.


# ...
module YourAppName
  class Application < Rails::Application
    # ...
    config.action_dispatch.default_headers["Permissions-Policy"] = "interest-cohort=()"
    # ...


The EFF has a detailed breakdown of why FLoC is a bad idea as well as a way to check if you’re included in their initial roll out.

In short, it’s not just bad because advertisers can track you around the Internet (still creepy after all these years!) but also because Google are leveraging their dominance in the browser market to further entrench their advertising monopoly.

The core Wordpress team are considering treating FLoC like a security concern and Wordpress powers over two-fifths of the Internet, so you’ll be in good company.

You might also might want to personally switch to Safari or Firefox or similar, even for your web development needs.

Why not?

Maybe you don’t mind about advertising tracking your users around the internet, which is a reasonable position.

That said… you don’t have to be a privacy absolutist to see that Google’s effective monopoly is somewhat an issue for even companies that use and pay for search or display adverts.


You can also add the FLoC opt-out header if you are deploying a Jekyll site on Netlify.

Brighton Ruby 2024

Still running UK’s friendliest, Ruby event on Friday 28th June. Ice cream + Ruby 

Last updated on May 24th, 2021 by @andycroll

An email newsletter, with one Ruby/Rails technique delivered with a ‘why?’ and a ‘how?’ every two weeks. It’s deliberately brief, focussed & opinionated.