The Full Stack Developer Guide Developer Hub

Welcome to the Full Stack Developer Guide developer hub. You'll find comprehensive guides and documentation to help you start working with the Full Stack Developer Guide as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Cookie expiration

Specify the number of days before the Optimizely visitor cookies will be set to expire.

Syntax

window["optimizely"].push(cookieExpiration);
Parameters
Parameter and Type
Child Attribute
Description

cookieExpiration
CookieExpirationObject

-

An object with the type field set to cookieExpiration. The other fields are the function arguments. Required.

type
object

Child attribute of type CookieDomainObject

The argument indicating that you are using the cookieExpiration function. Required.

cookieExpirationDays
integer

Child attribute of type CookieDomainObject

The cookie expiration defined in days.

Example Call

window["optimizely"].push({
  "type": "cookieExpiration",
  "cookieExpirationDays": 365
});

Description

Specify the number of days before the Optimizely visitor cookies will be set to expire. You must call "setCookieExpiration" prior to loading the Optimizely snippet. The minimum number of days that can be set is 90 (approximately three months). For more information on how Optimizely uses cookies, visit our Learning Center.

Note: Some Optimizely cookies are reset every time a visitor comes to the site, which means the expiration period set with this API call is used each time the cookie is set. You can also use the API to enable or disable the extend cookie lifetime function.

Updated 10 months ago


Cookie expiration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.