A magic cookie is a token of data exchanged from a server to a client that is used to track, authenticate and inform the client in the system about the presence of server. A magic cookie differs from a regular data packet because it does not contain readable data, only path information through which the server can be reached.
Magic cookies were formerly used to track and verify the presence of a user on a logging system, but are now used by Web servers to save the information of a user that visits a specific site on a network. The most commonly used type of magic cookie is the Hyper Text Transfer Protocol (HTTP) cookie by Web pages. Information in the cookie is encrypted and unreadable under normal circumstances and only the generator (server) can track information related to it. A first-party cookie tracks the users directly on the website being visited, whereas third-party cookies are normally used for user information to post related ads and privacy policy information.