> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.crisp.chat/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to automatically push user nicknames

*Learn how to set and read a visitor nickname from your website with the Crisp JavaScript SDK.*

If your website has authenticated users, you can pass their name to Crisp automatically. This saves customers from typing their name again and gives your team clearer contact context inside the Inbox.

---

# ${color}[#0080dd](Set the visitor nickname)

Use the **Crisp JavaScript SDK** after the Crisp chatbox snippet is available on the page.

```javascript
// Replace this value with the nickname from your own authenticated user data.
$crisp.push(["set", "user:nickname", ["John Doe"]]);
```

#### ${color}[#445055](Example with PHP)

When injecting the nickname from a backend template, escape it safely before printing it into JavaScript.

```html
<script>
  $crisp.push(["set", "user:nickname", [<?php echo json_encode($user_nickname); ?>]]);
</script>
```

This example assumes `$user_nickname` contains the authenticated user's full name.

#### ${color}[#445055](Set the email and nickname together)

If your website also knows the user's email, set both values in the same page logic.

```html
<script>
  $crisp.push(["set", "user:email", [<?php echo json_encode($user_email); ?>]]);
  $crisp.push(["set", "user:nickname", [<?php echo json_encode($user_nickname); ?>]]);
</script>
```

Setting the email is especially useful when you want the visitor session to be attached to a contact profile.

---

# ${color}[#0080dd](Read the visitor nickname)

You can read the nickname currently stored in the visitor session with `$crisp.get`.

```javascript
var visitorNickname = $crisp.get("user:nickname");
```

---

# ${color}[#0080dd](Go further)

The same SDK can also set the visitor email, phone number, company, avatar, custom data, segments, and events.

| Want to know more about the `$crisp` interface? Read [How do I use the $crisp chatbox SDK?](/en/article/how-do-i-use-the-crisp-chatbox-sdk-1lp254r/).