You need to use Javascript variables or Squiffy attributes (same thing, entered differently). They will be saved to the player's browser automatically. The player must click "Restart" to reset everything and restart the game.
http://docs.textadventures.co.uk/squiffy/attributes.html