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 latestscripttag available in Zendesk Support. SeeAdding the Web Widget (Classic) to your website or Help Center.如果你没有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:','',<parameters>);

Example

             
<scripttype="text/javascript">zE('webWidget:on','open',function(){consolelog('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 awindow.zESettingsobject. Make sure you add any settings before the Web Widget (Classic) snippet.

Example

             
<scripttype="text/javascript">windowzESettings={webWidget:{offset:{horizontal:'100px',vertical:'150px'}}};script>

The settings are grouped into core settings that affect the entire widget and channel-specific settings.