You are thinking of HTTP cookies which are used by web servers to differentiate users and to maintain data related to the user during navigation, possibly across multiple visits. These can only be set/read using a server-side language such as PHP.
Be aware that many browsers and anti-spyware programs block tracking cookies.
The secret of success in life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1890 - 1977)