If your chat widget requires customers to enter their email to start a chat, NeetoChat can prefill the email if you already have it, skipping that step. This method is also helpful to track user activities, even if the customer doesn't start a conversation.
To do this, add the following script to your project:
<script>
window.NeetoWidgetUserIdentity = {
user_identifier: "USER_ID_HERE",
name: "USER_NAME_HERE",
email: "USER_EMAIL_HERE",
started_at: "YYYY-MM-DD",
}
</script>
This can also be used at run-time in SPA's like React, Vue, etc.
Video
Automatically prefill values for custom fields:
Above, we saw how to provide the data for pre-chat questions. We can use the same method to provide the data for custom fields available at Settings > General Settings > Fields.
Each Field has a unique identifier (key), and you can add the value for each field by including the key in the NeetoWidgetUserIdentity object. This key can be copied from the Fields table.
Here's an example with multiple custom fields:
<script>
window.NeetoWidgetUserIdentity = {
user_identifier: "USER_ID_HERE",
name: "USER_NAME_HERE",
email: "USER_EMAIL_HERE",
started_at: "YYYY-MM-DD",
age: "USER_AGE",
gender: "USER_GENDER",
country: "USER_COUNTRY",
// Add other custom fields here
}
</script>