.visitor.trigger()

This API would allow you to configure your own custom trigger.

To do so:

  • Implement this JS API in your website.
  • Set a rule for which the API should be triggered in the Settings -> Automation -> Intelligent Triggers and choose the Invoke JS API option from the drop-down box.
  • The API will be invoked when the visitor matches the rule. If the trigger name is mentioned in the textbox, it will be passed as a parameter to the method. The second parameter would contain available visitor information.

PARAMETERS

triggername: Configured trigger name in the rule.

visitorinfo: This JSON object contains the details of the visitor that are available from the following list:

  • name - Name of the visitor.
  • email - Email address of the visitor.
  • phone - Contact number of the visitor.
  • browser - Name of the browser that the visitor is currently using.
  • os - Operating System of the machine that the visitor is using.
  • ip - IP address of the visitor.
  • ccode - Country code of the visitor.
  • se - Search engine name, if the visitor was re-directed to the website via a search engine.
  • sk - Search query used, if the visitor was re-directed to the website via a search engine.
  • region - Region of the visitor (APAC/CANADA/EMEA/NA/SA).
  • state - State of the visitor.
  • city - City of the visitor.
  • chats - Number of past chats.
  • visits - Number of visits.
  • noofdays - Number of days that the visitor had visited your site.
  • totaltime - Total time duration that the visitor had spent on your site(in milliseconds).
  • fintime - First time (Unix time) that the visitor visited your site.
  • lvtime - Last visited time of the visitor.,

Syntax

Copied$zoho.salesiq.visitor.trigger(function (triggername, visitorinfo);

Example

In this example, two different rules are set by the operator in Settings -> Automate -> Triggers. The Invoke JS API option is chosen from the drop-down box and then the trigger name is mentioned in the text box as shown below.

According to the first rule, the operator wants to trigger some custom action and engage the visitor, who had visited the website more than 10 times but never initiated a chat.

In the second rule, the operator wishes to display a discount banner only to the CRM users, whose CRM potentials are closing this month.

‚Äč                                                                                          

Copied<script>

$zoho.salesiq.ready = function ()

{


   $zoho.salesiq.visitor.trigger(function (triggername, visitorinfo)
   {


     if (triggername == 'Engage')
     {


       engageReturningVisitor();  // Implement your custom action here
     }


     else if (triggername == 'Show Discount Banner')
     {


       showDiscountBanner(); // Implement your custom action here
     }


   });


// other JSAPIs here


}


</script>