This content originally appeared on Perishable Press and was authored by Jeff Starr
Google has another new thing they are doing, called FLOC (Federated Learning of Cohorts). It’s used to — surprise — track user activity across websites. Opting out ideally is handled by the user, who can customize their browser settings to disable FLOC while surfing around the Web. Beyond configuring your browser to opt-out of FLOC, you can disable it on any website with a single line of code.
Opt-out your site
To opt any website or web page out of the FLOC monitoring program, add the following Permissions-Policy
header to your page(s):
Permissions-Policy: interest-cohort=()
You can read all of the details about this header in the official spec. And remember, this disables Google FLOC data collection on your site only. Once the visitor leaves your site, their activity may be tracked by FLOC elsewhere on the Web (unless it is disabled in their browser settings).
How to add via Apache/.htaccess
As explained in my tutorial on adding custom HTTP headers with .htaccess, we can use Apache’s Header set
directive to add the Permissions-Policy
header to the entire site:
Header set Permissions-Policy "interest-cohort=()"
Add that line to your site’s public/root .htaccess file, save changes, and done. Instant relief from Google’s latest data harvesting protocol for all of your site visitors.
This content originally appeared on Perishable Press and was authored by Jeff Starr
Jeff Starr | Sciencx (2021-04-28T22:01:27+00:00) Opt Out of Google FLOC for Site Visitors (One Line of Code). Retrieved from https://www.scien.cx/2021/04/28/opt-out-of-google-floc-for-site-visitors-one-line-of-code/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.