Save Cookie

Last updated: August 28th 2019

You can save cookie with {exp:super_cookies:set} tag. There are many parameters given below that you can use with this template tag.


This is required paramter. This will be name of your cookie. We recommend to give name wihout space or spacial characters.

{exp:super_cookies:get name="cookie_name"}


This is an optional paramter. You can specify how longer you want the cookie to be saved in browser. Default cookie save duration is 86400. (i.e., 1 day)

{exp:super_cookies:set name="cookie_name" duration="86400"}


This is an optional paramter. You can specify what path you want to have for this cookie. Defining path will hide cookie for overall site and will be visible to only the given path. Passing slash ( / ) is a global path. that means your cookie will be available and accessable to overall site. Default cookie path is /.

{exp:super_cookies:set name="cookie_name" path="/"}
{exp:super_cookies:set name="cookie_name" path="/about"}


This is an optional paramter. With this you can restrict cookie to be saved as SSL or not. Default parameter is no

{exp:super_cookies:set name="cookie_name" secure="yes"}


This is an optional paramter and works only with PHP method. HttpOnly is an additional flag included in a Set-Cookie HTTP response header. Using the HttpOnly flag when generating a cookie helps mitigate the risk of client side script accessing the protected cookie (if the browser supports it).

{exp:super_cookies:set name="cookie_name" method="php" httponly="yes"}


This is an optional paramter. You can specify domain of cookie. default domain is current domain.

{exp:super_cookies:set name="cookie_name" domain=""}


This is an optional paramter. With this parameter you can specify cookie saving method. It can be either php or script. Default cookie saving method is php.

{exp:super_cookies:set name="cookie_name" method="php"}
{exp:super_cookies:set name="cookie_name" method="script"}


This is an optional but very important paramter. You can specify value of a cookie in this parameter. If you not specify anything or not pass this parameter, default value for your cookie will be "-". You can have anything you want to save in this parameter.

{exp:super_cookies:set name="cookie_name" value="foo"}