Provide 24/7 affordable customer service with AI-powered chat.
Connect to learn more

Hiding chat box by region

Using the API to hide by region

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 cool ways you can use the getDetails API call!
Please provide the domain name where your Olark live chat is installed.
Include the relevant transcript URL, if possible. You can send us the specific URL from your Transcripts page.
If you see specific error messages, banners, warnings, notices, etc., please let us know here.
Max file size 10MB.
Uploading...
fileuploaded.jpg
Upload failed. Max size for files is 10 MB.
Thank you! Your submission has been received and you'll hear from us shortly!
Oops! Something went wrong while submitting the form.