Only allow chats from logged in visitors
If you only want to show the Olark chat box to visitors who are logged in, you can use this guide to set it up.
Setup Steps
- First you'll need your own server-side script to detect when a visitor is logged in. Create a conditional statement for logged in visitors, which you can then insert the below code into.
- Go to the Chat Widget settings page and enable the Hidden the by default option under Widget Visibility. Remember to save your changes!
- Use the Javascript API to show the chat box if a visitor is logged in. Here is an example:
// You need your own method of detecting whether a visitor is logged in//
if ($logged_in) {olark('api.box.show');}
Important Notice: We’ll do our best to help with any questions you have. However, please keep in mind that the JavaScript API is intended to be self-serve for web developers, so we’re not able to write or debug your code. If you’re experiencing issues, please be sure to have your developer, designer, or webmaster review the code you’ve written.
Oops! Something went wrong while submitting the form.