You may not always want to chat to people from every country. With Olark you can hide the chat box from visitors coming from a specific region.

This can be done with our Automation rules but this guide will focus on how to accomplish this with the Olark api.

Say for example, I am own a Maple Syrup company that can only ship to products to Canada. I’d use the getDetails API call to find out the visitor’s country. Then I would hide the chat box for any visitor not in Canada.

<script>
    olark('api.visitor.getDetails', function(details){

        if (details.country != 'Canada') {
            olark('api.box.hide');
        }
    });
</script>

This is just one of the many cool things you can do with the getDetails call.