api.chat.onMessageToOperator
Check for a message being sent to the operator
Usage
olark('api.chat.onMessageToOperator', function(event) {
// Your callback function
});
Arguments
event.message.body- the contents of the message
Notes
Whenever a message is sent to the operator, this will call the given callback with an event object.
Track messages to operators
Use your favorite analytics system to keep track of visitors who have sent a message to an operator (since they might be more valuable):
<script>
olark('api.chat.onMessageToOperator', function(event) {
yourAnalytics.track("chatted_with_operator");
});
</script>
Track positive reactions
Maybe you want to keep track of positive vs. negative reactions. You could watch when people send you smileys, indicating that they are happy:
<script>
olark('api.chat.onMessageToOperator', function(event) {
if (event.message.body.indexOf(":)") != -1) {
yourAnalytics.track("customer_is_happy");
}
});
</script>
If these statistics sounds cool to you, you should probably try enabling our Google Analytics plugin for a more in-depth integration with Google Analytics.