A JavaScript widget that developers can embed into their website to enable customers to easily search a knowledgebase or contact the help desk without leaving the page they're viewing.
The Help Widget channel is disabled by default and needs to be activated before use. To do this, go to Settings -> Tickets -> Channels and click the "Activate" link on the Help Widget channel row. The channel can be deactivated in the same way, instead this time by clicking the "Deactivate" link on the same row.
To configure the channel, go to Settings -> Tickets -> Channels and click the "Settings" link on the Help Widget channel row. The channel must already be activated beforehand.
It's possible to create and manage multiple configurations, in case you have multiple websites and need to show a different knowledgebase or use a different colour scheme on each. Start by clicking 'Add Widget'.
All the customisation options are optional.
If you make use of the multilingual functionality, you can define translations for the strings used in the widget. The language is automatically detected based on the user's browser.
The web widget is supported by the following browsers:
Device Type | Browsers |
---|---|
Desktop |
|
Mobile |
|
Other browsers and versions may be supported but are untested.
Once you have set up a valid configuration, click the preview button at the bottom to see your code in action. You will need to re-do the preview any time you change any configuration, customisation or translation option.
At the end of the page you will find the code that will need to placed on your website to show the widget. It should be placed towards the end of your HTML code, just above </body>
. Be sure to only copy the code once you've made all desired changes to your configuration as the code updates on changing most values.
Note, the widget configuration must be saved before using the code.
The Javascript code provided by our widget management tool can be modified if needed, for example to automatically set a name and email on the contact form. Below is our full default configuration file.
Setting a name and email address in the contact form automatically. We need to add the defaults
object to the submitTicket
configuration.
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
"submitTicket": {
"enabled": true,
"departmentId": null,
"subject": true,
"defaults": {
"name": "John Doe",
"email": "[email protected]"
}
},
...
});
};
</script>
A simple Javascript API has been made available to provide functions to modify the button and widget.
Function | Description |
---|---|
setLocale |
Set the locale to load the widget in, overrides the default behaviour of detecting the locale from the user's browser. |
setOffsetHorizontal |
Set the horizontal offset of the button and widget (popup only) from the left or right (based on settings) the browser screen. |
setOffsetVertical |
Set the vertical offset of the button and widget (popup only) from the bottom the browser screen. |
setDefaultSearchTerm |
Set the default search term for when the knowledgebase is loaded. |
toggle |
Open or close the widget depending on its current state. |
Set the locale to load the widget in, overrides the default behaviour of detecting the locale from the user's browser.
locale |
The locale string to load, e.g. 'fr' or 'en_US'. |
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
});
SupportPro.on('ready', function (el) {
el.setLocale('fr');
});
};
</script>
Set the horizontal offset of the button and widget (popup only) from the left or right (based on settings) the browser screen.
distance |
Distance from the left or right (based on settings) of the browser screen in pixels (integer). |
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
});
SupportPro.on('ready', function (el) {
el.getVueInstance().setOffsetHorizontal(40);
});
};
</script>
Set the vertical offset of the button and widget (popup only) from the bottom the browser screen.
distance |
Distance from the bottom of the browser screen in pixels (integer). |
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
});
SupportPro.on('ready', function (el) {
el.getVueInstance().setOffsetVertical(40);
});
};
</script>
Set the default search term for when the knowledgebase is loaded.
term |
The term to use for the search. |
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
});
SupportPro.on('ready', function (el) {
el.setSearchTerm('email');
});
};
</script>
Open or close the widget depending on its current state.
<script>
window.supportproAsyncInit = function () {
SupportPro.mount({
...
});
SupportPro.on('ready', function (el) {
el.getVueInstance().toggle();
});
};
</script>
Article Number: 269
Author: Jul 22, 2024
Last Updated: Jul 22, 2024
Online URL: https://docs.supportpro.vn/article/help-widget-269.html