olark('api.chat.onOfflineMessageToOperator', function(event) {
	// Your callback function
});

Arguments

  • event.message.body
    the contents of the message

Notes

When an offline message is sent to the operator, this will call the given callback with an event object

Track visitors who send you an offline message

Use your favorite analytics software to keep track of visitors who have sent an offline message to an operator (since they might be more valuable):

<script>
olark('api.chat.onOfflineMessageToOperator', function(event) {

    // Example code
    yourAnalytics.track("sent_an_offline_message");

});
</script>

Or, you could send a message back explaining that no-one is around, and point the visitor to your help center

<script>
olark('api.chat.onOfflineMessageToOperator', function(event) {


    olark('api.chat.sendMessageToVisitor', {
        body: "Sorry, we have just gone offline. We'll be back soon. In the meantime, why not check out our <a href="https://olark.com/help>Help Center</a>?"
    });

});
</script>