Skip to main content

← Help Center

JavaScript API

Customize and control the Olark chat box from your site's code.

Chat box behavior

Chat box appearance

Configure the chat box

Chat conversation

On chatbox load olark('api.chat.onReady', function(){ // Your callback function }); Check Olark has loaded Change operator group olark('api.chat.setOperatorGroup', { group: // Group ID from https://www.olark.com/op }); Lock the visitor to an operator group On operators available olark('api.chat.onOperatorsAvailable', function() { // Your callback function }); Trigger for when operators are available On operators unavailable olark('api.chat.onOperatorsAway', function() { // Your callback function }); Trigger for when operators are away On conversation start olark('api.chat.onBeginConversation', function() { // Your callback function }); Monitor when a conversation begins On message to operator olark('api.chat.onMessageToOperator', function(event) { // Your callback function }); Check for a message being sent to the operator On message to visitor olark('api.chat.onMessageToVisitor', function(event) { // Your callback function }); Check for a message being sent to the visitor On operator command olark('api.chat.onCommandFromOperator', function(event) { // Callback function } ); Monitor for an operator using a command Send message to visitor olark('api.chat.sendMessageToVisitor', options ); Send a message to the visitor Send operator notification olark('api.chat.sendNotificationToOperator', { body: string }); Send a notification to the operator Send visitor notification olark('api.chat.sendNotificationToVisitor', { body: string }); Send a notification to the visitor Offline message sent olark('api.chat.onOfflineMessageToOperator', function(event) { // Your callback function }); Monitor for an offline message being sent

Visitor information

Pre-chat survey

Greeter

Attention Grabber

Google Analytics

Targeted Chat