Статьи по теме: Contacts & CRM

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.



Set the visitor nickname


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


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


Example with PHP


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


<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.


Set the email and nickname together


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


<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.



Read the visitor nickname


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


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



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?.

Последнее изменение: 05/05/2026

Была ли эта статья полезна?

Поделиться отзывом

Отменить

Спасибо!