While you were poking around the four-legged Web pages, the site's server stashed a nugget of information on your computer. In this case the cookie included a record of your visit and the kinds of information you looked at. When you linked to the pet store's site on the second day, the store's Web server read the cookie on your computer, recognized you as a repeat visitor with an interest in hamster wheels and responded accordingly. If you have a Web browser on your computer, you also have a cookie file. Subsequently, the Web server can read your browser's cookie file.
Web sites use cookies for several reasons.
One is to gather targeted or personalized content, as in the example above. A cookie could also record the links or advertisements that you click on and add that information to a profile of your interests located in your cookie file. Cookies can remember your member ID and password so that you don't have to retype them every time you visit a membership site. Or a cookie can serve as a shopping cart for an electronic commerce Web site so that your browser remembers the items you wanted to purchase, even if you leave the site and return later. The point is to make the Web site more appealing to you, so you do come back again.