The name and data may be any visible plain text characters except semi-colons and commas. No particular encoding method is required, except it must be plain text and the program decoding it must know the method used. When your visitor's browser accepts a cookie from your site, it stores the record in a cookie database on the visitor's hard drive. Many shopping cart programs use cookies to keep track of items chosen for purchase. When a browser requests a page, the shopping cart program asks for any available cookies.
Cookies tell the shopping cart what items are already in the cart.
At checkout time, the latest cookies tell the shopping cart what items are being purchased. Many affiliate programs use cookies to determine whether or not a visitor has previously been at the site and which affiliate earns the referral. Your visitor clicks on one of your affiliate links. He arrives at the your affiliate company's site and their server sets a cookie with your affiliate number. Using cookies is the most accurate method of counting unique visitors to your site.