Both Google and Facebook take into account the things you look for online, the things you look at, the people you are connected to, and so on, and use this information to pelt you with ads they think you will respond to.