Cookies are text files stored on your computer which allow websites to do several things such as track users, remember user information and preferences and track user behaviour. Cookies can be controlled by the owner of the website or by third parties.
For example, an owner of a website can install a facebook pixel. This allows the owner of the website to add you to an audience of people they advertise to. If you visit a website which sells garden furniture, the next time you log into facebook you could see advertisements for garden furniture for the same website.