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:

AttributeDescriptionDatatype
nameName of the visitorString
emailThe email address of the visitorString
phoneThe contact number of the visitorString
osOperating system used by the visitor.String
countryCodeCountry code of the visitor.String
ipThe IP address of the visitorString
regionRegion of the visitor (APAC/CANADA/EMEA/NA/SA).String
cityCity(Location) of the visitor.String
stateState(Location) of the visitorString
numberOfChatsNumber of previously closed chats had by the visitorNumber
numberOfVisitsThe number of times the visitor has used the app.Number
noOfDaysVisitedNumber of days the visitor has used the appNumber
totalTimeSpentThe total time duration that the visitor had spent on your site(in milliseconds).Number
firstVisitTimeThe first time (Unix time) that the visitor visited your site.Number
lastVisitTimeThe 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
  }
}