Modifying the pre-chat survey
Wait! This article is part of our Developers section. Be sure to understand how each of the snippets works before customizing them for your site. We link to several helpful resources for learning, debugging and how we can help in our Developer API docs.
The pre-chat survey allows you to ask visitors for their name, email or phone number before starting a chat. You can enable and modify the survey in the Behavior and Text settings.
Even if the pre-chat survey is enabled in your settings, you would need to enable the plugin using this code in order to use the API calls listed below. The call should be put directly under the
/* custom configuration goes here (www.olark.com/documentation) */ line
in your Olark install code.
To disable the pre-chat survey on a page, you can set it to
- "required" for a required field
- "optional" for an optional field
- "hidden" to hide a field
Insert code like this, into your Olark snippet:
// This line is required, even if already enabled in preferences olark.configure("features.prechat_survey", true); // Modification options olark.configure('system.ask_for_name', 'required'); olark.configure('system.ask_for_email', 'optional'); olark.configure('system.ask_for_phone', 'hidden');
If you are comfortable working with APIs, and already collect user data via your own login, you can send that information to Olark using our guide to Visitor Insights.