Move cookie-generating code to client-side.