Hiding the Live Chat button on mobile websites can come in handy for scenarios when you have different designs or content for your desktop and mobile sites or when your mobile site is not fully ready for visitors and so forth.
The method you use depends on how your website is built:
- If your desktop and mobile sites use separate code bases:
Add the Live Chat code to the desktop site only. The chat button will not appear on your mobile site. - If your desktop and mobile sites share the same code:
You can hide the chat button on mobile using one of the following methods:- Add custom JavaScript in the Comm100 Control Panel. This method works no matter if you are using Adaptive, Image, or Text link type of chat button.
- Customize the Mobile View of the Image type of chat button. This method is available only if you are using the Image type of chat button.
If you use the same site code for both desktop and mobile and want to hide the chat button on mobile, follow the instructions below.
Add Custom JavaScript Code
To hide the chat button on mobile sites using custom JavaScript code, follow these steps:
- Log in to your Comm100 Control Panel.
- From the left navigation menu, go to Live Chat > Campaign > Chat Window.Note: If you are using multiple campaigns, ensure that you select the correct campaign. To learn more about multiple Campaigns, see this article.
- Expand the Advanced menu.
- Select Add custom JavaScript to my chat window and paste the following code.
var ifmobile = /mobile/i.test(navigator.userAgent); if (ifmobile) { Comm100API.onReady = function () { Comm100API.set('livechat.button.isVisible', false); }; } - Click Save.
The Live Chat button disappears from your mobile websites after the settings are successfully saved.
Customize the Image-Type Chat Button
If you are using the Image type of chat button, you can hide the button on mobile sites by customizing its Mobile View. Follow these steps:
- Log in to your Comm100 Control Panel.
- From the left navigation menu, go to Live Chat > Campaign > Chat Button.Note: If you are using multiple campaigns, ensure that you select the correct campaign. To learn more about multiple Campaigns, see this article.
- On the Chat Button page, verify that your chat button is Image type.
- Under the Mobile View area, clear the fields for Online text and Offline text. Make sure the fields are completely blank with no spaces.
- Click Save.