Custom Triggers
Use the EVENT_CUSTOMTRIGGER event to handle the "Invoke JS API" trigger action when trigger criteria matches.
Steps to use:
- Subscribe to the EVENT_CUSTOMTRIGGER event using the ZohoSalesIQ.addEventListener API.
- Select "Invoke JS API" as the resultant action for a trigger rule.
- Invoke the ZohoSalesIQ.performCustomAction API to send a trigger at a point of interest.
- Handle data received in the event(triggerName, visitorInformation) to perform a custom action.
Parameters:
triggerName: Name of the custom trigger set in trigger criteria.
visitorInformation: Object containing visitor information.
Visitor Information:
Attribute | Description | Datatype |
name | Name of the visitor | String |
The email address of the visitor | String | |
phone | The contact number of the visitor | String |
os | Operating system used by the visitor. | String |
countryCode | Country code of the visitor. | String |
ip | The IP address of the visitor | String |
region | Region of the visitor (APAC/CANADA/EMEA/NA/SA). | String |
city | City(Location) of the visitor. | String |
state | State(Location) of the visitor | String |
numberOfChats | Number of previously closed chats had by the visitor | Number |
numberOfVisits | The number of times the visitor has used the app. | Number |
noOfDaysVisited | Number of days the visitor has used the app | Number |
totalTimeSpent | The total time duration that the visitor had spent on your site(in milliseconds). | Number |
firstVisitTime | The first time (Unix time) that the visitor visited your site. | Number |
lastVisitTime | The last time (Unix time) that the visitor visited your site. | Number |
Example
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CUSTOMTRIGGER, (triggerInformation) => {
// your code goes here
});
Example Trigger Response
Copied{
"triggerName": "CartCheckout",
"visitorInformation": {
"name": "Patricia",
"email": "patricia@zylker.com",
"phone": "54827492740",
"region": "APAC",
"os": "iOS",
"ip": "191.191.91.91",
"city": "Chennai",
"state": "Tamil Nadu",
"firstVisitTime": 1601010100,
"lastVisitTime": 1601020190,
"countryCode": "in",
"totalTimeSpent": 102400,
"numberOfChats": 3,
"numberOfVisits": 24,
"noOfDaysVisited": 6
}
}