Use Firefox with Ublock Origin extension. Available both on PC/Mac and mobile. You can also enable the extension in incognito mode. This will prevent you from seeing ads in your browser.
Incognito mode creates a temporary profile where as soon as you close the window, all cookies and history are deleted in that profile.
However, websites can still collect information about you thanks to your IP address and browser fingerprint.
If you want more anonymity, I suggest using a VPN. Proton VPN and Nord VPN are two very recommended services.
Edit: I completely misunderstood that you were talking about something else entirely.
I'll leave my comment up anyway in case anyone might find it useful.