I use Piwik (https://github.com/matomo-org/matomo) and track visitors without their knowledge or consent, because I need analytics. Piwik is also configured to respect the "Do not track" header, so opting out is as easy as indicating that you don't wish to be tracked.
Is that wrong?
And I use Piwik precisely because it's self-hosted. I know for a fact your data doesn't get sold, because the data never hits any server except mine.
If this seems acceptable, it's also why legislation seems worrisome. There are a lot of corner cases that law tends to overlook. But hopefully the requirements won't be too onerous.