The advanced customization and control of your Web Widget is now even easier and more powerful.
- A new and improved API syntax
- Enhanced Web Widget control and flexibility with several new and reformatted APIs
- An extensive new suite of Chat APIs
- Updated API reference developer documentation, reorganized for easier navigation
The new API syntax
The new syntax accepts strings and doesn’t require wrapping everything in a function like before. Commands now follow this basic syntax:
zE('webWidget:<action>', '<event|property>', <parameters>);
Here is an example of how the structure has changed:
zE('webWidget', 'setLocale', 'de');
New and reformatted APIs
Identify and prefill
Previously, a single API call both created/updated the user in Support, and prefilled Web Widget name and email form fields. There was no way to render prefilled fields as read-only.
Now, these are two discrete actions that you can control independently:
zE('webWidget', 'identify', details)
This will send through your visitor’s name, email and organization and create or update the user record. It will no longer prefill your forms.
zE('webWidget', 'prefill', details)
This will pre-populate name, email or phone number fields on ticket forms, pre-chat form and Chat offline form to reduce friction for your visitor. In addition you can now specify “readOnly” to make the field non-editable.
Open and Reset (formerly zE.activate)
zE.activate would allow you to open the widget triggered by a user action (such as clicking on a custom launcher) and it would also reset the widget to its original state. If the widget was hidden it would show the widget. One drawback about zE.activate was that the reset functionality did not also clear form fields.
Now, instead of calling zE.activate, you would use
to open the widget (from a closed state) and
to reset the widget to its original state and clear any form fields (does not end any chats in progress). Reset can also be called independently of open.
Event APIs (new)
With the on API you can create listeners for user action events. For example,
zE('webWidget:on', 'close', callback)
would allow a callback to be fired when the widget is closed.
A common use for this could be where you have hidden something (such as a custom launcher) on your web page that you want to make visible again when the widget is closed.
Another example might be where you want to track events (e.g. how many times your widget is opened) in an external system such as Google Analytics.
Get APIs (new)
With the get APIs you can get information about the current state of the widget, for example
which returns a string with information about the current channel the widget is open to, or
which returns a boolean to indicate if the user is in an active live chat session.
A common use for this could be to detect if the widget is already open or if the visitor is already chatting, and if so, prevent another pop-up or widget from appearing on your web page so as not to overwhelm your visitor.
Other new and updated core APIs
to close the widget (from an open state).
to display the widget hidden from the page with zE.hide.
to hide the widget from the page.
to clear any information from forms (without resetting the widget state).
to open or close the widget (depending on its state).
New Chat APIs
We now support an extensive range of Chat APIs from the Web Widget to better customize your Chat experience and route to agents. These APIs are available with the Web Widget integrated Chat experience EAP.
Updated API developer docs
We’ve reorganized the Web Widget API developer documentation to make it easier to find the command or setting you’re looking for. APIs are now organized by product channel (Help Center, Tickets, Chat and Talk) or by core APIs.