---
title: Cookie Expiration
slug: performance-edge/api/cookie-expiration
docTags: 
createdAt: 2026-06-23T07:35:07.339Z
---

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

## Description

Specify the number of days before the Optimizely Performance Edge visitor cookies will be set to expire. You must call "setCookieExpiration" prior to loading the Optimizely Performance Edge snippet. The minimum number of days that can be set is 90 (approximately 3 months).

:::BlockQuote
📘 Note

Some Optimizely Performance Edge 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.
:::

```javascript
window.optimizelyEdge.push(cookieExpiration);
```

```javascript
window.optimizelyEdge.push({
  "type": "cookieExpiration",
  "cookieExpirationDays": 365
});
```

## Parameters

This table provides general information about required and optional parameters.

| Parameter                                            | Type    | Description                                                                                         |
| ---------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------- |
| **cookieExpiration** *required*                      | object  | An object with the type field set to cookieExpiration. The other fields are the function arguments. |
| **cookieExpiration.type** *required*                 | string  | The argument indicating that you are using the cookieExpiration function.                           |
| **cookieExpiration.cookieExpirationDays** *optional* | integer | The cookie expiration defined in days.                                                              |

:::BlockQuote
📘 Note

This API is ignored when setting the [`optimizelyRedirectData cookie`](https://help.optimizely.com/Set_Up_Optimizely/Cookies_and_localStorage_in_the_Optimizely_snippet#First-party_cookies_in_Optimizely_X), used for forwarding redirect experiment info to the new page.
:::

