# Maximum Storage Lifetime

This feature allows users to configure the maximum lifetime for cookies and local storage entries set by JENTIS. Once a data entry's configured lifetime has expired, it will either be automatically removed by the browser (cookies) or removed by our script the next time a user accesses it (local storage).

**The Maximum lifetime can be configured on three levels:**

* Default set by JENTIS (730 days / 2 years)
* Global Default Customer setting, which is applicable for all containers of the JENTIS account
* Container level setting

We will always use the most specific setting when calculating the maximum lifetime. The lifetime limit is applied as soon as you publish your configuration.

<figure><img src="/files/NxRMQIaoQJNtF6h8sH5b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Important to note that this functionality only works with the JENTIS wrapper scripts that are provided with the JENTIS Web SDK.
{% endhint %}

{% code overflow="wrap" lineNumbers="true" %}

```javascript
window.jentis.helper.setCookie({
    "name": "test-lifetime-cookie",
    "value": "test-lifetime-cookie",
    "exdays": 1000,
    "sameSite": "Strict"
});

window.jentis.helper.setServerCookie({
    "name": "test-lifetime-server-cookie",
    "value": 'test-lifetime-server-cookie',
    "exdays": 1000 * 24 * 60 * 60 * 1000,
});

window.jentis.helper.setLocalStorageItem("test-lifetime-localstorage", "test-lifetime-localstorage", 1000 * 24 * 60 * 60 * 1000);


const cookie = window.jentis.helper.readCookie('test-lifetime-cookie');
const serverCookie = window.jentis.helper.readCookie('test-lifetime-server-cookie');
const localStorage = window.jentis.helper.getLocalStorageItem("test-lifetime-localstorage");
```

{% endcode %}

If you have any questions or suggestions, contact us through our [Helpdesk](https://jentis.atlassian.net/servicedesk/customer/portal/1/group/-1).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jentis.com/jentis-dcp-elements/account-settings/maximum-storage-lifetime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
