---
title: Extend Cookie Lifetime
slug: performance-edge/api/extend-cookie-lifetime
docTags: 
createdAt: 2026-06-23T07:36:48.021Z
---

Enable or disable automatically extending the expiration period of visitor cookies.

## Description

By default, whenever the snippet activates, it resaves any existing Optimizely Performance Edge visitor cookies onto the currently-configured cookieDomain and with the currently-configured cookieExpiration.

For example, if you use the Cookie Expiration API to specify a lifetime of 365 days, you can use Extend Cookie Lifetime to ensure the cookie’s expiration does not get refreshed on each snippet activation. In this case, the cookie will expire after 365 days from the first time it was set with that expiry period specified.

Call this API with `isEnabled: false` to prevent Optimizely Performance Edge from automatically extending the expiration period of its cookies.

- Any unchanged cookies, such as the `optimizelyEndUserId` cookie for returning visitors, will retain the original domain and expiration date that were specified during a prior snippet activation.
- Any new or modified cookies, such as the `optimizelyEndUserId` cookie for new visitors and visitors subject to `waitForOriginSync`, will still be set using the currently-configured `cookieDomain` and `cookieExpiration`.

:::BlockQuote
📘 Note

You must call this prior to each snippet initialization to suppress the cookie-extending behavior.
:::

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

```javascript
window.optimizelyEdge.push({
  "type": "extendCookieLifetime",
  "isEnabled": false
});
```

## Parameters

This table provides general information about required and optional parameters.

| Parameters                                    | Type    | Description                                                                                                                     |
| --------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **extendCookieLifetime** *required*           | object  | An object with the type field set to extendCookieLifetime.                                                                      |
| **extendCookieLifetime.type** *required*      | string  | The argument indicating that you are using the extendCookieLifetime function.                                                   |
| **extendCookieLifetime.isEnabled** *optional* | boolean | Set to false to prevent Optimizely Performance Edge from extending the lifetime of existing cookies when the snippet activates. |

