It’s already a law in Europe. GDPR and ePrivacy. You have to get consent from the user. Having worked for European companies, they take it seriously.
https://techcrunch.com/2019/07/24/researchers-spotlight-the-... | https://www.eff.org/deeplinks/2023/11/debunking-myth-anonymo...
Not every company will do it well. Simpleanalytics.com seems to be one of the better ones.
But it’s still way better than the alternatives which don’t even try to be anonymous.