Here's how to supposively "disable FLoC" in django using middleware.
Create a file middleware.py
in one of your apps with
class DisableFlocMiddleware:
""" Disable Google's FloC tracking
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
response['Permissions-Policy'] = "interest-cohort=()"
return response
Then add it to your MIDDLEWARE
setting:
MIDDLEWARE =[
# ...
'yourapp.middleware.DisableFlocMiddleware'
# ...
]
To verify it is "working" make sure the response has the header.
Some predictions:
- They will probably have "a bug" that prevents this from working
- Doing this will probably hurt your search rank when your site is indexed
- If enough people do this they will simply start ignoring it
It's sad that the moral standards of some individuals are so low that they use their talents to create malware.