---
title: "JavaScript SDK: Cookies"
description: "Configure cookies for Gleap session management with the Gleap JavaScript SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/421-javascript-sdk-cookies
collection: "JavaScript"
updated: 2026-11-01
language: en
---

# JavaScript SDK: Cookies

Configure cookies for Gleap session management with the Gleap JavaScript SDK. Follow the integration code examples.

If you want Gleap to use cookies for the session management, you can enable the feature by setting `useCookies` to true before calling `Gleap.initialize()`.

```javascript
Gleap.setUseCookies(true);
```

The default value is _false_.

> **Info:** You MUST set useCookies to false OR true before initializing the Gleap SDK.

### Why do we use cookies?

As many customers want to keep a session throughout all subdomains, we use cookies to enable session tracking through all subdomains. If you disable the cookie session management, you will need to identify your users on all subdomains separately.

## Related

- [JavaScript SDK setup](https://docs.gleap.ai/en/articles/393-javascript-sdk-setup.md)
- [JavaScript SDK: Code snippet](https://docs.gleap.ai/en/articles/394-javascript-sdk-code-snippet.md)
- [JavaScript SDK: User identity](https://docs.gleap.ai/en/articles/395-javascript-sdk-user-identity.md)
- [JavaScript SDK: Callbacks](https://docs.gleap.ai/en/articles/396-javascript-sdk-callbacks.md)
- [JavaScript SDK: AI chatbar](https://docs.gleap.ai/en/articles/397-javascript-sdk-ai-chatbar.md)
