setCookiePath
The setCookiePath() method sets a path for which visitor cookies (_pk_id.*
) and session cookies (_pk_ses.*
) are stored. The default path is /
.
Syntax
setCookiePath(path)
setCookiePath(path): void
setCookiePath(path): void
setCookiePath(path): void
setCookiePath(path): void
setCookiePath(path): void
setCookiePath(path): void
Parameters
Path (string, required)
A path for which visitor and session cookies are stored The default is /
.
Examples
To set a new path /blog/
:
setCookiePath("/blog/")
setCookiePath("/blog/"): void
setCookiePath("/blog/"): void
setCookiePath("/blog/"): void
setCookiePath("/blog/"): void
setCookiePath("/blog/"): void
setCookiePath("/blog/"): void
Notes
- The visitor cookie (
_pk_id.*
) and the session cookie (_pk_ses.*
) contain the visitor ID. If you change the path, the visitor ID cookie will only be available under that path.
Related methods
- enableCookies()
- disableCookies()
- deleteCookies()
- hasCookies()
- setCookieNamePrefix()
- setCookieDomain()
- getCookieDomain()
- getCookiePath()
- setSecureCookie()
- setVisitorCookieTimeout()
- getConfigVisitorCookieTimeout()
- setReferralCookieTimeout()
- setSessionCookieTimeout()
- getSessionCookieTimeout()
- setVisitorIdCookie()
Updated 6 days ago