Cookies are small text files stored by a website or web application on a users device. Often cookies are used to keep users logged in on a website, but they can also be used to track a users surfing habits on the internet, and thereby allow personalizing ads based on what website a user have visited.
There are two types of cookies, the persistent cookie and the session cookie.
Session cookies are temporary files which are deleted when the browser is closed. If you re-visit the website later, it will not be able to recognize you.
persistent cookies are stored until they expire, as specified by the expire date in the cookie file. Or they are deleted when you manually clear your browsing data in your browser.
It is possible to configure a browser not to accept cookies, or only accept cookies from whitelisted domains. Check the documentation for your specific browser for more information on how to do this.
How to stop tracking by advertising companies
Unfortunately, it is difficult to stop all tracking. You can however configure your browser to not accept cookies from third parties.
You can also visit an advertising opt-out page, and choose to opt-out of ads. Keep in mind that opting out may depend on cookies to work, meaning if you delete your cookies after opting-out, you may need to opt out again. For more information on personalized ads see this answer by Google: Opt out of seeing personalized ads (google.com)