NAV
javascript

.setUserEmail()

var email = '[email protected]';

// Set the email field
SnapEngage.setUserEmail(email);

// Do the same as above AND make the email field read-only
// i.e. not editable for the visitor
SnapEngage.setUserEmail(email, true);

This API will do three things:

First, it pre-populates the 'email' field on your prechat or offline form (if this field exists).

Second, this API will provide a visitor’s email address to an agent who takes the chat. The email gets stored on the conversation (case) and will be passed to your integration at the close of the case.

Third, on submit of a prechat or offline form, a cookie will be stored in the visitor's browser called 'SnapABugUserEmail' to repeat this same behavior on future chats. Read more about the SnapABugUserEmail cookie here.

Parameters

Parameter Type Description
email String A non-encoded email address, for example, '[email protected]'. You will need to use your local environment to deliver the email address to this function, either through server-side scripting or JavaScript.
locked boolean An optional parameter. If set to true, the email field will be locked i.e. read-only and the visitor will not be able to edit the field. If set to false, the email field will not be read-only and the visitor will be able to edit the field (this is the default).