There has been a lot of interest in the way in which advertisers gather the targeting information they use to target ads. The EFF has a detailed investigation into how facebook does this. This shows how your offline activities are used to refine the online advertisements that are shown by facebook. While this just covers facebook, many other sites use these companies and others to do similar things.
Personally I always use add blockers, back from the day when advertisers use animations and flashing to draw you eye, making it hard to read the content of the site. While this doesn’t prevent tracking it just cleans up my screen and makes the content readable.
I also came across this info-graphic that explains much of the on net tracking technology in a fairly understandable manner.