This document outlines all the events published on the brand’s page by the Live Assist Tag. These events provide customers transparency into the engagement and engagement window display flow, as well as a way to customize and act upon the obtained data. For example, a brand can hide an embedded div content only if the embedded engagement is displayed.
To listen to an event you can either:
- Call lpTag.events.bind method with the appName, eventName and your callback function.
Code sample:lpTag.events.bind(appName, eventName, callbackFunction);
-
Call lpTag.events.bind method with an object configuration. This option includes more options. Code sample:
lpTag.events.bind({
eventName : "EVENTNAME",
appName : "APPNAME",
func: callbackFunction,
context: callbackFunctionExecutionContext,
async: true, //default is false,
triggerOnce : true
});
Properties
OptionalName | Description | Type | Required | Notes |
---|---|---|---|---|
eventName | The name of the event. | string | Required | |
appName |
The name of the app that creates the event. If you do not know the name of the app, you can leave the default value to receive events from all apps. |
string | Optional | Default: "*". |
func | The callback function when the event is triggered. | Function | Required | |
context | The object which is the execution context of the function. Useful if you rely on context ("this") in your code. | Object | Optional | Default: null. |
async | When set to yes, the callback will be triggered when there is free CPU time. This option is recommended when there is heavy procession to run, in order to avoid freezing the UI. | Boolean | Optional | Default: false. |
triggerOnce | When set to yes, your callback will unbind after it is called once. | Boolean | Optional | Default: false. |
Callback
The callback function that you define will be passed event data and event information as two separate objects.
Event Information object structure:
{
eventName: "MYEVENT",
appName: "TRIGGERINGAPP"
}
The event data object will vary depending on the event that you are binding to.
Callback Function example:
The example below prints the event data and event info:
function processThis(data, eventInfo){
if(window.console && window.JSON){
console.log(JSON.stringify(data) + " triggered by: " + JSON.stringify(eventInfo));
}
}
//Use the above "processThis" callback to print event data and info to the console
lpTag.events.bind("lp_sdes", "VAR_ADDED", processThis);
Events
Visitor Flow Events
These events include monitoring and decision events.
VAR_ADDED
This event is triggered when an Engagement Attribute (SDE) is reported.
Event Information
Name | Value |
---|---|
eventName | "VAR_ADDED" |
appName | "lp_sdes" |
Event Properties
Name | Description | Type / Value |
---|---|---|
The SDE JSON | JSON |
Example (Transaction Engagement Attribute):
{
"type": "cart", //MANDATORY
"total": 11.7, //TOTAL CART VALUE
"numItems": 6, //NUMBER OF ITEMS IN CART
"products": [{ //ARRAY OF PRODUCTS
"product": {
"name": "prod1", //PRODUCT NAME
"category": "category", //PRODUCT CATEGORY NAME
"sku": "sku", //PRODUCT SKU OR UNIQUE IDENTIFIER
"price": 7.8 //PRODUCT PRICE
}, "quantity": 1 //NUMBER OF PRODUCTS
}]
}
MONITORING_STATE
This event is triggered when monitoring starts and/or when its state is changed.
Event Information
Name | Value |
---|---|
eventName | "MONITORING_STATE" |
appName | "lp_SMT" |
Event Properties
Name | Description | Type / Value |
---|---|---|
active | The monitoring state. | Boolean |
Example:
{
active: true/false
}
Engagement Events
These are engagement-related events, including rendering, display and interactions with the engagement.
START
This event is triggered when the flow to display the engagement has started.
Event Information
Name | Value |
---|---|
eventName | "START" |
appName | "LP_OFFERS" |
Event Properties
Name | Description | Type / Value | Notes |
---|---|---|---|
contexts | The engagement and page context ID (impression ID) in the current monitored session. | Array of Objects | Example: [ {"EngagementContext":{"id": "1"}}, {"pageContext":{"id":"173828"}} ] |
campaignId | The engagement’s campaign ID. | ALPHA_NUMERIC | |
engagementId | The engagement ID. | ALPHA_NUMERIC | |
engagementRevision | The engagement revision. | ALPHA_NUMERIC | |
engagementType | The engagement format. | Numeric | Available values: 0: "Peeling corner", 1: "Overlay", 2: "Toaster", 3: "Slide-out", 5: "Embedded", 6: "Sticky" |
contextId | The engagement context ID (engagement impression ID) in the current monitored session. | ALPHA_NUMERIC | |
zoneId | Internal. The engagement zone ID. | ALPHA_NUMERIC | |
state | The agent's state | Numeric | Available values: 1 - online, 2 – offline, 4 - busy |
confKey | Internal. CampaignId + EngagementId + Revision. | string | |
tglName | Internal. The engagement format description. | string | |
done | If the configuration has finished loading. | Boolean | |
engagementName | The engagement name as defined in Live Assist UI. | string |
Example:
{
"contexts": [
{"EngagementContext": {
"id": "1"
}
},
{"pageContext": {
"id": "1738225948"
}
}
],
"campaignId": 210599710,//The campaign Id
"engagementId": 210600710,//The engagement Id
"engagementRevision": 18,//The revision we are going to show
"engagementType": 3,//The engagement type
"contextId": "1",//The context (instance in memory on the backend)
"zoneId": 471288710, //The zone this is on
"state": 2, //The current state of the agents (online, offline, busy) , to set the display state
"confKey": "210599710_210600710_18",
"tglName": "slider" //The taglet that needs to be downloaded
"done": true, //If the configuration has finished loading
"engagementName": "Slide-out chat button" //The description of the engagement
}
OFFER_DISPLAY
This event is triggered when the engagement has been rendered and is going to be displayed on the page.
Event Information
Name | Value |
---|---|
eventName | "OFFER_DISPLAY" |
appName | "LP_OFFERS" |
Event Properties
See START event.
Example:
{
"contexts": [
{"EngagementContext": {"id": "2"}},
{"pageContext": {"id": "1738225948"}}
],
"campaignId": 248955910,//The campaign Id
"engagementId": 248956110,//The engagement Id
"engagementRevision": 14,//The revision we are going to show
"engagementType": 6,//The engagement type
"contextId": "2",//The context (instance in memory on the backend)
"zoneId": 471288510,//The zone this is on
"state": 2,//The current state of the agents (online, offline, busy) , to set the display state
"confKey": "248955910_248956110_14",
"tglName": "overlay",//The taglet that was downloaded
"done": true,//If the configuration has finished loading
"engagementName": "Mine"//The description of the engagement
}
OFFER_IMPRESSION
This event is triggered when the engagement has been displayed on the page.
Event Information
Name | Value |
---|---|
eventName | "OFFER_IMPRESSION" |
appName | "LP_OFFERS" |
Event Properties
See START event.
OFFER_CLICK
This event is triggered when the engagement has been displayed on the page.
Event information
Name | Value |
---|---|
eventName | "OFFER_CLICK" |
appName | "LP_OFFERS" |
OFFER_TIMEOUT
This event is triggered when an engagement duration has timed out.
Event Information
Name | Value |
---|---|
eventName | "OFFER_TIMEOUT" |
appName | "LP_OFFERS" |
Event Properties
See START event.
OFFER_DECLINED
This event is triggered when an engagement is closed by a user.
Event Information
Name | Value |
---|---|
eventName | "OFFER_DECLINE" |
appName | "LP_OFFERS" |
Event Properties
See START event.
OFFER_REMOVE
This event is triggered when an engagement is removed from the DOM (auto or user initiated).
Event Information
Name | Value |
---|---|
eventName | "OFFER_REMOVE" |
appName | "LP_OFFERS" |
Event Properties
See START event.
Chat Window Events
These are chat window related events. Because the customer conversation is contained within the window, the events provided here are related to the lifecycle of a conversation.
Note: These events will only be triggered for an embedded mode window, not a pop-up window.
state
This event triggers when the chat state is changed.
Event Information
Name | Value |
---|---|
eventName | "state" |
appName | "lpUnifiedWindow" |
Event Properties
Name | Description | Type | Notes |
---|---|---|---|
state | The chat state. | string | Available states: "resume", "initialised", "uninitialised", "preChat", "postChat", "offline", "waiting", "chatting", "interactive", "ended", "Notfound" |
Example:
{ "state" : "chatting" } //The current chat state
conversationInfo
This event triggers when the conversation data was changed, for example the conversation state.
Event Information
Name | Value |
---|---|
eventName | "conversationInfo" |
appName | "lpUnifiedWindow" |
Event Properties
Name | Description | Type | Notes |
---|---|---|---|
agentName | The agent name to which the visitor is connected. | string | |
agentId | The agent ID to which the visitor is connected. | ALPHA_NUMERIC | |
state | The chat state. | string | Available states: "resume", "initialised", "uninitialised", "waiting", "chatting", "ended", "Notfound" |
monitoringSessionId | Session ID. | ALPHA_NUMERIC | |
visitorId | Visitor ID. | ALPHA_NUMERIC | |
skill | The conversation skill. | string | |
engagementId | The engagement ID that was clicked to open the chat. | ALPHA_NUMERIC | |
campaignId | The engagement’s campaign ID. | ALPHA_NUMERIC | |
language | The conversation language. | string | An ISO 639-1 Alpha-2 language code in lowercase and an ISO 3166-1 Alpha-2country code in uppercase, separated by a dash. For example, en-US or fr-CA. |
engagementName | The engagement name as defined in Live Assist UI. | string |
Example:
{
"agentName": "John Doe",
"agentId": 2,
"conversationId": 4294973105,
"state": "chatting",
"monitoringSessionId":
"WIoWBRC_RL6pkcK5fL-3-g.5bb46ddd7ae63b731b5eeb10189b15bc97226af0",
"visitorId": "UYxShcOtSEWq0oSsuMCrOQ",
"skill": "MySkill",
"engagementId": 1346152510,
"campaignId": 1346152410,
"language": "en-US",
"engagementName": "Sticky chat button"
}
engagementData
This event triggers when the state changes to "chatting" to show the engagement info.
Event Information
Name | Value |
---|---|
eventName | "engagementData" |
appName | "lpUnifiedWindow" |
Event Properties
Name | Description | Type | |
---|---|---|---|
engagementName | The engagement name as defined in Live Assist UI. | ALPHA_NUMERIC | |
state | The chat state ("chatting"). | string |
Example:
{
"engagementName" : "Sticky chat button",
"state": "chatting"
}
maximized
This event triggers when the chat window is in maximized view.
Event Information
Name | Value |
---|---|
eventName | "maximized" |
appName | "lpUnifiedWindow" |
minimized
This event triggers when the chat window is in minimized view.
Event Information
Name | Value |
---|---|
eventName | "minimized" |
appName | "lpUnifiedWindow" |
windowClosed
This event triggers when the chat window is closed (disposed and removed from the DOM).
Event Information
Name | Value |
---|---|
eventName | "windowClosed" |
appName | "lpUnifiedWindow" |