NAV
javascript

.setUserName()

var name = 'Arya Stark';
SnapEngage.setUserName(name);

This API will do four things:

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

Second, it updates the visitor alias that is displayed in the chatbox chat transcript.

Third, this API will provide the visitor’s name to the agent who takes the chat. If the user's email is known, SnapEngage will update the database contact with this name (note: see green box below).

Fourth, this API stores a cookie in the visitor's browser called 'SnapABugUserAlias'1 to repeat this same behavior on future chats. Read more about the SnapABugUserAlias cookie here.

1 This cookie was previously known as the 'SnapABugUserName' cookie which is now deprecated.

Parameters

Parameter Type Description
name String A non-encoded name, for example, Arya Stark. You will need to use your local environment to deliver the name to this function, either through server-side scripting or JavaScript.