Web Widget (Classic)
The Web Widget (Classic) API is a JavaScript API for controlling the display and data passed to and from the Web Widget (Classic). You can embed the Web Widget in any website to provide your customers with Zendesk functionality such as ticketing, live chat, talk, and Help Center content.
Embed the widget in your website using the latest script
tag available in Zendesk Support. See Adding the Web Widget (Classic) to your website or Help Center. If you don't have access to Zendesk Support, ask a Support admin to get the tag for you.
The API consists of settings to change the widget properties and commands to perform actions.
Commands
All commands follow the same basic syntax:
zE('webWidget:<action>', '<event|property>', <parameters>);
Example
<script type="text/javascript">
zE('webWidget:on', 'open', function() {
console.log('The widget has been opened!');
});
</script>
The commands are grouped into core commands that affect the entire widget and channel-specific commands.
Settings
You can specify settings for the widget by defining a window.zESettings
object. Make sure you add any settings before the Web Widget (Classic) snippet.
Example
<script type="text/javascript">
window.zESettings = {
webWidget: {
offset: { horizontal: '100px', vertical: '150px' }
}
};
</script>
The settings are grouped into core settings that affect the entire widget and channel-specific settings.