While various software such as browsers and security software try to prevent such user data extraction and targeted ads, pi-hole is freeware that is easy to set up on UNIX/Linux systems (supported systems) and protects small networks (e.g. home network) from trackers and targeted ads by serving as a DNS sinkhole server for the network being protected. It checks a list of blocked domains (known ads/trackers) and returns 0.0.0.0 when lookups are attempted for those domains, thereby speeding up website loading and preventing the establishment of network connections to the ad/tracker domains. Pi-hole uses a forked and modified version of dnsmasq for DNS (and DHCP) services.
I’ve been using Pi-hole on a Raspberry Pi 4 for the past 6 months and I like it. I do see fewer ads than before (tested before/after Pi-hole). The AdminLTE dashboard is very good and intuitive. Of course, the effectiveness of this solution depends on the “blocklist”. The blocklist is periodically updated and you may add your own domains to the blocklist via the GUI or the CLI (pihole command).