I am using the jquery from https://github.com/carhartl/jquery-cookie.
I am using the cookies for very first time. If I set the query by:
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
This creates the query but do not retain after the browser is closed. I dont have idea how to do that.
Secondly, every time I refresh the page it over writes the cookies as I dont need like this, I need to have check whether I am the first visitor or no. If no get the cookied or else set the cookie.
You need to add a condition to see if a cookie already exists so that it doesn’t get replaced. Try: