---
title: "Identify users and send attributes and events"
description: "Tell Gleap who is signed in, attach the data you already have, track what people do, and stop users impersonating each other."
url: https://help.gleap.ai/fr/articles/230-identify-users-and-send-attributes-and-events
collection: "Get started"
updated: 2026-11-18
language: fr
alternates: [en]
---

# Identify users and send attributes and events

Tell Gleap who is signed in, attach the data you already have, track what people do, and stop users impersonating each other.

Identifying a user tells Gleap who is on the other side of the conversation. Without it, every visitor is anonymous, which limits what Kai can answer and what you can target. This article is for whoever adds Gleap to your product's code. It works the same on every plan and in every SDK.

### Call identify after sign-in

Run this wherever your app knows who the user is: right after login, and on page load for a session that's already signed in.

```js
Gleap.identify("user-123", {
  name: "Franz Huber",
  email: "user@example.com",
  plan: "Pro",
  createdAt: new Date("2024-03-01"),
  company: {
    id: "acme-inc",
    name: "ACME Inc."
  },
  customData: {
    seats: 12,
    trialEndsAt: "2026-09-01"
  }
});
```

The first argument is your own user ID. Use the value your database uses, and keep it stable. It's how Gleap recognises someone across sessions and devices, so an ID that changes produces a new contact each time.

Call `Gleap.clearIdentity()` when someone logs out. It ends the signed-in session and removes the session cookies the SDK set, so on a shared computer the next person doesn't continue as the previous one. Call it before you sign in a different user, too.

### What you can send

Gleap understands these built-in fields: `name`, `email`, `phone`, `avatar`, `plan`, `value`, `sla`, `createdAt` and `tags`, plus the `company` object. They land in the right places: the email is the address you reply to, and the avatar is the picture your agents see.

Anything else goes in `customData` as key-value pairs, for example seats, a trial end date or a feature flag you care about. Custom data shows on the contact, works in audience filters and segments, and Kai can read it.

-   **Values** can be text, numbers, true/false, dates, or lists of text or numbers. Nested objects are dropped, so flatten them first (`billingPlan`, not `billing: { plan }`).
    
-   **Up to 100 custom keys** are stored per call. Send the handful you'd actually filter on: a contact with six attributes is easier to read than one with fifty.
    
-   **Don't reuse a built-in name** for something else. A custom `value` or `plan` is treated as the built-in field, with its type checks.
    

### Update data later

When something changes mid-session, such as an upgrade, send just the fields that changed:

```js
Gleap.updateContact({ plan: "Enterprise" });
```

Passing `null` for a field clears it.

### Keep the spelling consistent

Attribute keys are case-sensitive. `trialEndsAt` and `trialendsat` are two different attributes, and filters, audiences and segments match the exact casing. A rule built on one silently ignores data sent under the other.

When you define an attribute under **Settings → Inbox & tickets → Data attributes**, the editor shows a **Casing mismatch** warning if your recent contact data uses a different spelling. Fix the spelling in your code rather than ignoring it.

### Link the user to a company

Pass a `company` object to group contacts under the organisation they belong to. That's what lets you see everyone from one customer together, and what company-level SLAs are based on.

-   **The id is required.** Without it the whole company is ignored. Use a stable identifier from your own system, not the display name.
    
-   **Only id and name are used.** Put company-level attributes such as seat count on the company record, through the server-side Companies API or a CSV import (see [Group contacts into companies](https://help.gleap.ai/en/articles/343-group-contacts-into-companies.md)). `company.name` only fills in a company that has no name yet and never replaces an existing one.
    
-   **The nested object needs SDK 16.3.0 or later.** On earlier versions, pass the flat `companyId` and `companyName` instead. Those keep working.
    

### Track events

Attributes say what someone is. Events say what they did:

```js
Gleap.trackEvent("invited-teammate", { count: 3 });
```

Events show on the contact's page, and outbound messages and workflows can react to them: a checklist that advances when someone finishes setup, or a survey after a first export. Name each event for what happened, in one consistent style. "invited-teammate", "Invite Sent" and "invite\_teammate" are three different events. Gleap already tracks page views on its own, so you don't need to send those.

### Check that it worked

1.  Sign in to your own product so `identify` runs, and trigger one event.
    
2.  In Gleap, open **Contacts** and find yourself.
    
3.  Check your custom attributes in the details on the right of the contact page. Attributes you've defined show there (**All N attributes** opens the rest), and data you haven't defined as an attribute yet is listed under **Custom data**. Your event is under the **Activity** tab.
    

![Avery Morgan’s fictional contact profile, activity and ticket history in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/ykx45n4OSNLcq702IW8F4IU0etx90v1Qujj8s9owM2qa1rjIqroQwkXKUo59HGMR2f0q741SjDK.png)

![Customer identity settings with identity keys and Require a signature in a demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/EfJhN8YPpE4TxaewwNKn7MTX73vw4twOZOFpIa1mZzpVA4LjIONvx3SLElW2mVEmtzOLyeilero.png)

If nothing shows up, check that `identify` ran at all. A contact still marked as a guest is the usual explanation.

The same calls exist in the mobile and cross-platform SDKs, with the same field names. If you have both a web app and a mobile app, identify with the same user ID in both so people don't end up as two contacts.

### Sign users in with an identity token

Anyone who can read your client-side code could call `identify` with someone else's user ID. An identity token proves who the user is: your backend signs it, and Gleap checks it.

1.  An admin creates an identity key under **Settings → Security → Customer identity → Identity keys**. Gleap shows the secret once. Store it in your backend's configuration.
    
2.  After login, your backend signs a short-lived token with that key. It holds the user ID and, if you want, the email, name, company, other attributes and your billing customer IDs such as `stripeCustomerId`, so Kai finds the right billing record.
    
3.  Your app passes the token to Gleap after login and on every app start:
    

```js
await Gleap.setUserJwt(token);
```

You can also give the SDK a provider with `Gleap.setUserJwtProvider` that returns a fresh token from your backend. From JavaScript SDK 19.5.2 (19.5.0 in the mobile SDKs), the provider also restores the signed session after a page reload or app restart when no grant is held. Still call `setUserJwt` on every app start. The token's expiry only limits the sign-in: the signed session then lasts as long as **Signed login lasts** under **Settings → Security → Customer identity** allows, 7 days by default.

4.  Turn on signed sessions. Creating a key alone changes nothing for your users. Under **Settings → Security → Customer identity**, the **Sign your users in** setup walks you through it: create an identity key, check a token from your backend, then click **Turn on** next to **Turn on signed sessions** and confirm with **Turn on**.
    
5.  Once every version of your app sends a token, switch on **Require a signature** for each platform you ship to (web, iOS, Android) on the same page. From then on, Gleap refuses a sign-in without a valid token on that platform.
    

Everything in the token is signed. Only put emails in the token that your system has confirmed. With **Merge contacts by email** switched on, Gleap can bring the person's earlier conversations together, but only with contacts whose email is proven: emails sent to your support address, contacts created through the server API, and contacts that confirmed their email with a code. A guest who only typed an email into the chat is never merged. See [Avoid and clean up duplicate contacts](https://help.gleap.ai/en/articles/16751964-avoid-and-clean-up-duplicate-contacts.md).

To stop the app from changing a field such as the plan, mark it **Only signed updates** under **Settings → Inbox & tickets → Data attributes**. From then on, only the token can change that field. Send other data with `updateContact` as before.

> **Warning:** Keep the identity key on your server. Never put it in your app or your frontend code. Turning on Require a signature before your apps send a token locks users out.

Server code for each language and the call for each SDK are in the developer guide [Customer identity](https://docs.gleap.ai/en/articles/709-customer-identity). Moving from an older integration? See [Upgrade to identity tokens](https://docs.gleap.ai/en/articles/16752008-upgrade-to-identity-tokens).

### Related

-   [Install the Gleap SDK](https://help.gleap.ai/en/articles/228-install-the-gleap-sdk.md)
    
-   [Avoid and clean up duplicate contacts](https://help.gleap.ai/en/articles/16751964-avoid-and-clean-up-duplicate-contacts.md)
    
-   [What Gleap knows about a contact](https://help.gleap.ai/en/articles/341-what-gleap-knows-about-a-contact.md)
    
-   [Group contacts into companies](https://help.gleap.ai/en/articles/343-group-contacts-into-companies.md)
    
-   [Where to find your keys and IDs](https://help.gleap.ai/en/articles/16751989-where-to-find-your-keys-and-ids.md)
