Django middleware to disable Google's Federated Learning of Cohorts (FLoC
) tracking
New version is Topics API
- Python 3.8+
- Django versions 3+
Install django-floc-disable:
pip install django-floc-disable
Add it to your MIDDLEWARE
tuple in settings.py
:
MIDDLEWARE = (
# ...
'django_floc_disable.middleware.FLoCDisableMiddleware',
# ...
)
This will set the Permissions-Policy
header to a value of browsing-topics=()
for every request served by Django.
Reference:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/browsing-topics
- https://developers.google.com/privacy-sandbox/private-advertising/topics/web/controls#opt_out_as_a_developer
- Issues: https://github.com/nhymxu/django-floc-disable/issues
- Here you can donate for this project.
The MIT License (MIT). Please see License File for more information.