---
title: "JavaScript SDK: User identity"
description: "Identify customers and attach user information with the Gleap JavaScript SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/395-javascript-sdk-user-identity
collection: "JavaScript"
updated: 2026-11-01
language: en
---

# JavaScript SDK: User identity

Identify customers and attach user information with the Gleap JavaScript SDK. Follow the integration code examples.

The Gleap Identify call lets you tie a user to their feedback items. It includes a unique User ID and optional meta information such as their email and name.

### Identify your users

To effectively manage your contacts, we advise using `Gleap.identify()` each time a user signs in or registers. This practice ensures accurate identification of your contacts from the outset. Additionally, for scenarios where contact information needs to be updated during active usage – such as when a user subscribes to a new plan or modifies their existing data – we recommend utilizing `Gleap.updateContact()`. This method allows for seamless real-time updates to contact details.

Identify your user by calling the following method.

```javascript
Gleap.identify("19283", {
  name: "Franz",
  email: "franz@gleap.ai",
  phone: "+1 (902) 123123",
  value: 199.95,
  plan: "Pro plan",
  // Optional: associate the user with a company.
  company: {
    id: "acme-inc",
    name: "ACME inc.",
  },
  // Passing the createdAt property allows you to set the correct createdAt date. (optional)
  createdAt: new Date(),
  customData: {
    key1: "awesome",
    key2: true,
  },
});
```

The optional `company` object associates the user with a company. Only `company.id` is required — it is your own identifier for the company. The optional `company.name` is a fallback label and never overwrites a name set authoritatively via the [server-side Companies API](https://gleap-developer-docs.gleap.help/en/articles/708-rest#companies).

> **Info:** The nested `company` object requires SDK version 16.3.0 or later. On earlier versions, pass the flat `companyId` and `companyName` properties instead — they remain fully supported.

> **Info:** When transmitting custom data, only primitive numeric and string values are supported for later use in segment filters. Please note that you can send only 35 custom data keys with an identify call.
>
> We currently only allow JSON strings, numbers and boolean values as custom data.

> **Info:** Gleap defaults to guest sessions when feedback items get reported without calling the identify method first. All feedback items of an existing guest session will be merged with the user session once you've identified it.

### Enforce identity verification

> **Tip:** To also prove the user's email, pass a [signed identity token](https://gleap-developer-docs.gleap.help/en/articles/709-enforce-identity-verification#signed-identity-token-proves-the-email-too) in place of the user hash. Gleap can then [merge earlier conversations](https://gleap-developer-docs.gleap.help/en/articles/709-enforce-identity-verification#merge-contacts) with that email into the user.

To require authentication for new conversation attachments, see [Authenticated conversation files](https://gleap-developer-docs.gleap.help/en/articles/710-authenticated-conversation-files), including the customer login URL and redirect setup.

Enforce identity verification to prevent third parties from impersonating logged-in users. [Learn how to generate the user hash](https://gleap-developer-docs.gleap.help/en/articles/709-enforce-identity-verification)

```js
Gleap.identify(
  "19283",
  {
    name: "Franz",
    email: "franz@gleap.ai",
    phone: "+1 (902) 123123",
    value: 199.95,
    plan: "Pro plan",
    company: {
      id: "acme-inc",
      name: "ACME inc.",
    },
    customData: {
      key1: "awesome",
      key2: true,
    },
  },
  "GENERATED_USER_HASH"
);
```

[Click here](https://gleap-developer-docs.gleap.help/en/articles/709-enforce-identity-verification) to learn how to generate the user hash.

### Update contact properties

To effectively manage your contacts, we advise using `Gleap.identify()` each time a user signs in or registers. This practice ensures accurate identification of your contacts from the outset. Additionally, for scenarios where contact information needs to be updated during active usage – such as when a user subscribes to a new plan or modifies their existing data – we recommend utilizing `Gleap.updateContact()`. This method allows for seamless real-time updates to contact details.

```javascript
Gleap.updateContact({
  value: 199.95,
  plan: "Pro plan",
});
```

The updateContact method takes in the same contact parameters as the identify method. Partial updates are possible.

```javascript
Gleap.updateContact({
  name: "Franz",
  email: "franz@gleap.ai",
  phone: "+1 (902) 123123",
  value: 199.95,
  plan: "Pro plan",
  company: {
    id: "acme-inc",
    name: "ACME inc.",
  },
  customData: {
    key1: "awesome",
    key2: true,
  },
});
```

### Removing data

Update are run incrementally. If you want to remove data, you can do so by adding a key value pair with `null` as value.

```javascript
Gleap.updateContact({
  keyToDelete: null,
});
```

### Clear the identity on logout

We recommend to clear the identity once the user logs out. Clearing the identity will automatically detach the current session and create a new guest session.

```js
Gleap.clearIdentity();
```

### Get the identification status of a user

With the following method, you can get the status of the current user identity.

```js
Gleap.isUserIdentified();
```

### Get the current user identity

With the following method, you can get the current user identity.

```js
Gleap.getIdentity();
```

## 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: 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)
- [JavaScript SDK: Frontend tools](https://docs.gleap.ai/en/articles/398-javascript-sdk-frontend-tools.md)
