olark('api.box.onExpand', function() {
	// Your callback function
});

Notes

Whenever the chatbox is expanded, the given callback function will be triggered.

Screenshot of API call on expand

Watch for visitors clicking the chatbox

A visitor to your site might expand the chatbox, but not initiate a conversation. You can check to see if a conversation has started and if not, send the visitor a message after 3 seconds.

<script>
// Triggers when the chat box has been expanded
olark('api.box.onExpand', function() {

    // Use getDetails to grab visitor information
    olark('api.visitor.getDetails', function(details){

        // isConversing tells you if any messages has been exchanged
        // between the visitor and the operator
        if (!details.isConversing) {

            // Wait 3 seconds (3000 milliseconds)
            setTimeout(function(){

                // Use the API to send the visitor a message
                olark('api.chat.sendMessageToVisitor', {
                    body: "Let me know if you have any questions."
                });

            }, 3000);

        }

    });

});
</script>

Track when visitors expand your Olark widget

If you are trying to track when visitors interact with the Olark widget, to perhaps test out different methods of presenting the widget, you can use this following example to do so.

<script>
olark('api.box.onExpand', function(event) {

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

});
</script>