add cookie function.