JavaScript API¶
Introduction¶
This document explains in detail the semantics of the function calls you can make using the 247LiveChat JavaScript API.
247LiveChat API is accessible via global window.__247lc
object. Below you will find description of available methods.
Available methods¶
__247lc.renderIcon()
¶
Renders chat icon as configured in profile settings.
__247lc.openWidget()
¶
Opens chat widgdt as configured in profile settings.
Events¶
Chat tracking object __247lc
receives the following events:
__247lc.on('load', callback)
¶
Fires when DOM is fully loaded and chat widget ready to use. Any metgods on __247lc
object should be deffered until this even is emitted.
__247lc.on('update', chat, oldState, netState)
¶
Fires when chat widget state changes. The state object has the following parameters:
{
availableUsers: 3, // Number of available Chat operators
buttonPosition: 'b-r' // Chat icon position
buttonDimensions: '24x24', // Chat icon dimensions
buttonOnline: 442, // ID of online chat icon image
buttonOffline: 443, // ID of offline chat icon image
hideOfflineButton: true, // Flag to show or hide offline icon
widgetPosition: 'b-r' // Chat widget position
}