Re: "how does that even work?"
NOTE: I believe tracking should be opt-in only, above board, and you should be able to view it and manage it yourself on the tracker's web site, but I doubt any legislation will really help, so I use my own mitigations anyway. it doesn't mean I won't support such legislation, I just don't have any hope in it. That being said...
For anything other than simple web surfing (including El Reg) I have a special non-priv logon that I use, and the browsers that I run get their caches adn history dumped, every time.
Firefox is simple, just tell it to delete history on exit.
Chrome is not so simple, but works better with CAPTCHA [firefox fails a lot for some reason, probably by design] but you can run a script to wipe out everything in the following directories to clear chrome's cache:
rm -rf ~/.cache/chromium/Default/*
rm -rf ~/.config/chromium/BrowserMetrics*/*
etc. - there are others, too - my script is pretty long, and rather thorough
But as a hint, there are many files in ~/.config/chromium/Default/ that are created by chrome and if you wipe them out, they just re-appear. Some of them have persistent "things" in them. YMMV.
In any case, getting a handle on how to purge your cache and history (while keeping any important settings 'intact') might make a topic of its own someplace. in the mean time you can experiment a bit.
What's good about using Linux or FreeBSD: if you set your X server up to allow connections to localhost via the DISPLAY environment variable, you can use a shell to log in to a very unprivileged user account, then run firefox or chromium on the current desktop by setting DISPLAY via 'export' (or similar), and be in a COMPLETELY different user context. It works for video playback, too. then when you are done, wipe away ALL history. Hard to track you with NO history, NO cookies, NO persistent data, yotta yoltta. Other settings like 'private browsing' and whatnot can't hurt, either. And of course THIS would be for any site where script is unavoidable, like the DMV or certain electronics parts retailers that I can't avoid using.
worth pointing out, windows 7 had 'run as' which could be used in a similar way, so that you have a apecial user context JUST for web surfing that really doesn't do anything else... and you can auto-delete history and cache and so on with no consequence to YOU.
But... if you EVER log into certain sites, that 'icon' on half the pages you visit is part of their tracking. Its very presence probably tracked you opening up that web page... unless you do NOT have login information stored in a cookie [which is where purging the persistent data comes into play]. So if you did use FB or twitter or reddit or google login, you'd do that from the "web surfing only" user account, or maybe even a special "FB only" user account, and "flush" when you're done, so they don't know it's you.
and for everything else, on your 'normal surfing' user account, you NEVER log into google, FB, twitter, reddit, or ANY of those other "they will track you" web sites.