In this guide we’ll show you how you can launch and close your Chaty app widget using a JavaScript function in a few super simple and quick clicks.
To learn more about how to use the Chaty app click here, and don’t forget to check our entire Chaty app knowledgebase to make the most out of it.
You can use this feature to launch or close your Chaty app widget from anywhere on your website, for example, through a button or an image.
How to launch your Chaty app widget
Let’s take the example from above. To launch the Chaty app widget with a JavaScript function, add a button of your choice on your site. This custom button will serve as a custom button that visitors will click to close the Chaty app widget. Click to edit the button depending on your page builder and add. the below JavaScript function:
javascript:launch_chaty();
Note!
Please note that if you have more than one Chaty widget, you need to pass the widget ID too. You can find your Chaty widget ID in the URL when you edit a widget. Check the example below!
Let’s assume we are in the settings of our second widget. When you click on the browser URL, you will find the widget ID, like so:
In this case, our second widget ID is “620iyuohqz”. So, the function in this case will be like this:
javascript:launch_chaty("620iyuohqz");
How to close your Chaty app widget
To close the Chaty app widget with a JavaScript function, add a button of your choice, just like in the above example. This button will serve as your custom button that visitors will click to close the Chaty app widget. Edit the button depending on your page builder and add the below JavaScript function.
javascript:close_chaty();
And of course, following the example above, to close our second, etc. Chaty widget, we will use the function below:
javascript:close_chaty("620iyuohqz");
When you’re done, don’t forget to hit ”Save”. That’s it! Easy as 1,2,3 ☺️
In the end, depending on your settings and customisations, it may look something like this: