PHP Live! Help Desk
Search:
» Help Desk Home » APIs and Integrations » OnlineOffline JavaScript callback functions
OnlineOffline JavaScript callback functions

For webpages that contain the live chat Standard HTML Code (the HTML Code option that contains JavaScript), when the page loads, perform various custom actions.

 

The callback feature was introduced with PHP Live! v.4.6.1.  Previous versions will not be able to process the callbacks.

 

  • The online_offline_status (1,0 - 1=online, 0=offline) is passed as the function parameter.
  • The department_id is the ID of the department of the chat icon HTML Code.  Department ID of 0 (zero) signifies "All Department" chat icon HTML Code.  The department_id can be obtained by looking at the chat icon HTML Code structure phplive_launch_chat_0(), the 0 would be the department_id (another example: phplive_launch_chat_1() the 1 would be the department_id).  If there are multiple chat icon HTML Code on the same page, some functions may get called multiple times and the department_id parameter will be useful.

 

// when the chat icon is loaded, call this function, if exists

phplive_callback_loaded( online_offline_status, department_id )

 

// when the chat icon is clicked, call this function, if exists
phplive_callback_launchchat( online_offline_statusdepartment_id )

 

// when the chat status is online, call this function, if exists

phplive_callback_online( department_id )

 

// when the chat status is offline, call this function, if exists

phplive_callback_offline( department_id )

 

// when the embed window is minimized, call this function, if exists.  there are no function parameters because the action is to simply minimize the embed chat window
phplive_callback_minimize()

 

// when the embed window is maximized, call this function, if exists.  there are no function parameters because the action is to simply maximize the embed chat window
phplive_callback_maximize()

 

// when the embed window is popped out, call this function, if exists.  there are no function parameters because the action is to simply popout the embed chat window
phplive_callback_popout()

 

 // when the embed window is closed, call this function, if exists.  there are no function parameters because the action is to simply close the embed chat window
phplive_callback_close()

 

NOTE: Keep in mind, the live chat icon loads asynchronously, meaning the live chat icon may load before the entire page is actually loaded.  To ensure the callback functions are called, place the above callback functions BEFORE the PHP Live! chat icon HTML Code.

 

NOTE: If there are multiple chat icons on the same page, the callback functions that contains the department_id parameter will be called for each chat icon HTML Code that has a different department ID.  This is to ensure the proper ID is passed to the callback function.  If the multiple chat icon HTML Code on the same page references the same department ID, the callback functions will be called only once.

Was this helpful?
could be more helpful? let us know
1 people found this helpful