Toggle open/close state
To toggle the open/close state of a widget loaded on your page without having to click the phone icon toggle you can use this function:
Load/replace a widget
It is sometimes desirable to be able to replace a widget running on the page with a different widget. For instance, one use case would be that you have a Single Page Application (SPA) where you have two routes which link to two different departments. On each these routes you want to display a differently configured widget, e.g. with a different icon and different agents.
The function to load/replace a widget is this:
hiddenMode: false // Find more information on 'hiddenMode' below
Please note that the installation code needs to run once on your page before you can use the above function.
Installation Code Configuration
It is possible to load the widget in a "hidden mode", which will install the widget as usual on your page, but it won't show the phone icon.
To start the widget in "hidden mode" use the default installation code with the additional parameter
cwHiddenMode=true as shown in the example below:
can be used to open/close the widget programmatically, e.g. when the user clicks a button you provide on your page. This technique gives you the possibility for very customised integrations of the widget into your page.
new-modal_responseiq to a clickable element on your page (e.g. a button or a link) and we will automatically toggle the open/close state of the widget when this element is clicked.