← Back to API
Send operator notification
olark('api.chat.sendNotificationToOperator', {
body: string
});
Arguments
- options.body
the contents of the notification to send the operator
Notes
Send a notification message to the operator. The operator will see [info] to indicate that this message was not sent from the visitor.
Notify operator on landing pages
You can send your operator a notification when the visitor lands on a particular page, such as a landing page:
<script>
// Checks if the current URL contains 'landing'
if (document.location.href.indexOf('landing') != -1) {
olark('api.chat.sendNotificationToOperator',
{
// Send a custom notification
body: 'visitor landed on the billing page'
});
}
</script>
Notify operators on landing pages after one minute
Perhaps you want to notify an operator when a visitor is hesitating on a page for more than 60 seconds, so you can choose to initiate a chat with them:
<script>
// Create a timer
setTimeout(function(){
olark('api.chat.sendNotificationToOperator',
{
// Send a custom notification
body: 'this visitor is hesitating'
});
// Set time to 60 seconds (60000 milliseconds)
}, 60000);
</script>