# User Identification

Luciq helps you better identify the bug reports or feedback you get by associating a user's identity to them.

### User Email and Name

If you already have a user's name and email, you can pre-fill the email field in the bug, feedback, and question reporting flow. The user will then be identified in all reports (bugs, improvements, questions), crashes, surveys, and feature requests.

Ideally, this API should be called as soon as a user logs into your app.

JavaScript

{% code title="Identify user" %}

```javascript
Luciq.identifyUser("e-mail", "username", "id");

//Example:
Luciq.identifyUser("[email protected]", "John Appleseed", "2374927027");
```

{% endcode %}

{% hint style="danger" %}
**IMPORTANT: The `userID` Must Be Unique**

The `userID` you provide is the primary identifier for a user within the Luciq. You **must** ensure that this ID is unique for each of your users.

Providing a generic, non-unique ID (e.g., "guest" or "unknown\_user") for multiple users will cause their data to be incorrectly merged. This will lead to critical data integrity and privacy issues, such as **different users being able to see and reply to each other's private chat conversations**.

If a user is anonymous, **do not call** the `identifyUser` API. The SDK will automatically handle a unique anonymous identity for you.
{% endhint %}

{% hint style="warning" %}
**Null Values**

If both the email and ID parameters are empty or null, the user will not be identified, and the SDK will throw an error.
{% endhint %}

### User Data

You can also add additional data about your users. This API is best used for dumping large amounts of data. Each call to this method overrides the user data to be attached. The maximum length of the string is 1,000 characters.

JavaScript

{% code title="Set user data" %}

```javascript
Luciq.setUserData("User data sample");
```

{% endcode %}

### Logout

When a user logs out, the following API should be called. Calling `logOut` will reset the value of the email and name previously set. It will also remove any currently set user attributes, user events, user chats, and user data.

JavaScript

{% code title="Log out user" %}

```javascript
Luciq.logOut();
```

{% endcode %}

{% hint style="warning" %}
**Logout only when user is identified**

Please note that if the user is currently not identified using the `identifyUser` API, the `logOut` method will have no effect.
{% endhint %}


---

# 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.luciq.ai/react-native/setup-luciq-for-react-native/custom-settings/user-identification.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.
