api.chat.onMessageToVisitor
Whenever a message is sent to the visitor, this will call the given callback with an event object
event.message.bodythe contents of the message
Examples
Use your favorite analytics system to keep track of how long it takes an operator to respond to a visitor:
olark('api.chat.onMessageToOperator', function(event) {
var visitorSentAt = +new Date;
olark('api.chat.onMessageToVisitor', function(event) {
var operatorSentAt = +new Date;
yourAnalytics.track("operator_response_time", operatorSentAt - visitorSentAt);
});
});
If these statistics sound cool to you, you should probably try enabling our
Google Analytics plugin
for a more in-depth integration with Google Analytics.
Discussion
Feel free to propose good uses for this method, or even drop us some suggestions for improvement! You can also join our mailing list to collaborate with other developers and get updates from us.