The server might use the ID to look up information in a database. The database might contain information about previous visits, the pages this user has visited, any information this user has provided in the past. If there is a cookie, the JavaScript generates a special greeting. Legitimate uses Provide new user information once, or skip an introduction on subsequent visits. For a nice example using music, click here .
Users can avoid typing information every time they revisit.
A nice source for more information about cookies.