Статьи по теме: Developers

How to automatically set users email addresses

Learn how to set an authenticated visitor email address from your website code.


When your website already knows the visitor email, you can pass it to Crisp so the customer does not need to type it again before starting a conversation.



Set the visitor email


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


// Replace this value with the email from your own authenticated user data.$crisp.push(["set", "user:email", ["user@example.com"]]);


Crisp expects a valid email address. If the value is invalid, the SDK may raise an error unless safe mode is enabled.



Example with PHP


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


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


This example assumes $user_email contains the authenticated user email.



Read the current email


You can read the visitor email from the SDK with:


var visitorEmail = $crisp.get("user:email");


Read the $crisp Methods documentation for more user setters and getters.

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

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

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

Отменить

Спасибо!