> For the complete documentation index, see [llms.txt](https://help.usejimo.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.usejimo.com/docs/for-developers/for-developers/sdk-guides/identify-users.md).

# Identify users

Identify your users to better understand your dashboard data and prevent duplicate users.

At Jimo, we care for the privacy of your users. Therefore, it's not required to identify them before giving feedback. But from your side, this can be annoying to receive feedback from an anonymous user.

Jimo allows you to identify users by passing **a unique identifier** in order to:

* Know who has interacted with experiences
* Prevent duplicate users
* Unlock segmentation, targeting, and content personalization based on your own user data

{% hint style="warning" %}
**Carefully choose your identifier**

* Make sure your identifier is unique and not guessable (ex. UUID, NanoId, CUID, etc.). Most of the time, a good identifier would be the internal id of the user in your system.
* In some companies, customer support team or admins can log in to their end-users accounts, for customer or debugging purposes. In this specific case, we advise you to either disable the Identification feature (do not call the identify command), or to not load Jimo at all, to prevent unexpected behavior.
  {% endhint %}

## The identify command

To identify users, make sure to have the SDK installed on your web app, then use the following command:

```javascript
window['jimo'].push(['do', 'identify', [userId]]);
```

Call it when the user authenticates (login), and on app load if a session is already active.

## How commands are processed (command buffering)

The Jimo snippet creates a global command queue (`window.jimo = []`) before the script itself loads. You can push commands to this queue at any time, even before Jimo has finished initializing.

When the script initializes, it reads the queue and processes it in a fixed order:

1. The `identify` command runs first and initializes the user profile.
2. Every other queued command (`set` calls, etc.) is held back and executed once the profile is ready.

This guarantees that your user data is always attached to the right profile, in a predictable order, no matter when the script actually finishes loading.

## Recommended pattern: set first, identify last

Push your `set` commands first, and finish with the `identify` call:

```javascript
window['jimo'].push(['set', 'user:name', ['Sam Taylor']]);
window['jimo'].push(['set', 'user:email', ['sam@example.com']]);
window['jimo'].push(['set', 'user:attributes', [{ plan: 'Pro', role: 'admin' }]]);
window['jimo'].push(['do', 'identify', ['b7b8c565-65a0-4dbd-8438-3b8c8773f49f']]);
```

Why this order works best:

* `identify` triggers the authentication logic and initializes (or switches) the profile.
* `set` commands are enrichment: they wait until the profile is initialized, then apply to it.
* By pushing the `set` calls before `identify`, everything is already sitting in the buffer when the profile initializes. Nothing runs in parallel with the authentication, so every command is applied in order, to the right user.

The same pattern applies in a SPA or when Jimo is already loaded: queue the user data, then identify.

{% hint style="info" %}
**Legacy: the identify callback**

Older integrations pass a callback as the second argument of `identify` and run their `set` calls inside it:

```javascript
window['jimo'].push([
  'do',
  'identify',
  [
    userId,
    () => {
      window['jimo'].push(['set', 'user:name', [username]]);
    },
  ],
]);
```

This pattern is still supported for backward compatibility, but it is no longer the recommended approach: the callback execution timing is not guaranteed in every situation, while buffered commands are always applied in a predictable order. For new integrations, use the set first, identify last pattern above.

If you use [Identify Verification](/docs/for-developers/for-developers/sdk-guides/setup-identify-verification.md), the signed identifier stays in third position and the callback slot is simply set to `null`.
{% endhint %}

## Avoid repeated identify calls

Calling `identify` with a **different** user ID triggers a full profile switch: the script re-initializes entirely for the new user. This is expected when a user logs out and another logs in, but you should not call `identify` repeatedly in your app flow.

* Call `identify` once per session, typically at login.
* To update user data afterwards, use `set` commands: they enrich the current profile without re-initializing anything.

## Force Identify

If you want to guarantee that no anonymous user is ever created, enable the **Force Identify** option in [Settings > Installation > Identification](https://i.usejimo.com/settings/install/identify). Jimo will not initialize until an `identify` call is received; any command pushed in the meantime stays buffered and is applied automatically once ready. See [Installation](/docs/settings/installation.md) for details.

## Examples

See below a screenshot of a profile without identification and one with an id (b7b8c565...) and a user name (Sam) pushed.

<figure><img src="https://2283895109-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ1pi3sC2zIV5o9Oa46Aq%2Fuploads%2F47cG3wID8z8TiikOnWXm%2Fwithout-identify.jpg?alt=media&amp;token=508899ae-a10f-4c5f-804b-252da5b443f1" alt=""><figcaption><p>Without identify</p></figcaption></figure>

<figure><img src="https://2283895109-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ1pi3sC2zIV5o9Oa46Aq%2Fuploads%2FFBVMyIdzwzhaYG28I3O7%2Fwith-identify.jpg?alt=media&amp;token=2fdf4b11-089a-4af9-b198-d62e9c2d99bd" alt=""><figcaption><p>With identify</p></figcaption></figure>

Here is the code used to identify the profile:

```javascript
window['jimo'].push(['set', 'user:name', ['Sam']]);
window['jimo'].push(['do', 'identify', ['b7b8c565-65a0-4dbd-8438-3b8c8773f49f']]);
```

## Related pages

* [Setup the segmentation](/docs/for-developers/for-developers/sdk-guides/setup-the-segmentation.md): push default and custom attributes for targeting
* [Setup Identify Verification](/docs/for-developers/for-developers/sdk-guides/setup-identify-verification.md): sign your identify calls to prevent spoofing
* [SDK Methods](/docs/for-developers/for-developers/sdk-methods.md): full command reference
* [Installation](/docs/settings/installation.md): snippet setup and the Force Identify option
