Let's say you want to track a conversion when a new chat has been started on a specific page, the best way to do it is with callbacks.
These are the callbacks you can use as you need.
Please check first the tutorial to understand how the Live Chat Javascript integration works.
When you have correctly integrated the live chat as described in the tutorial, you can add callbacks as described below.
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onChatClosed: function() { … }, } });
This is an example where we added the onChatClosed callback.
Let's get deep in the knowledge of each callback.
If you want to be notified from the live chat when someone instances a new conversation with you, you can use the onLeadGenerated callback.
The function returns:
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onLeadGenerated: function( email ) { … }, } });
The onChatOpened callback will be triggered when the client opens the chat window. Ideal if you want to control the live chat icon after they open the chat window. (To control the chat window please refer to the tutorial here)
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onChatOpened: function() { … }, } });
The onChatClosed callback will be triggered when the client closes the chat window. Ideal if you want to hide the live chat icon after they close the chat window. (To close the chat window please refer to the tutorial here)
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onChatClosed: function() { … }, } });
The onNewConversation callback will be triggered when a user or a lead start a new conversation. Ideal if you want to track in Google Analytics or other analytics service you use the pages with more conversation opened.
The function returns:
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onNewConversation: function( message ,attachments ) { … }, } });
The onProfilingQuestionAnswered callback will be triggered when the lead answer to any of the profiling questions.
The function returns:
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onProfilingQuestionAnswered: function( attribute, value ) { … }, } });
The onProfilingQuestionAsked callback will be triggered when any of the profiling questions have been shown to the visitor.
The function returns:
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onProfilingQuestionAsked: function( attribute ) { … }, } });
The onRealtimeVideoAnswered callback will be triggered when the client answers a Realtime Video Call.
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onRealtimeVideoAnswered: function() { … }, } });
The onRealtimeVideoRejected callback will be triggered when the client rejects a Realtime Video Call.
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onRealtimeVideoRejected: function() { … }, } });
The onHelpCenterArticleOpened callback will be triggered when the client opens a Help Center Article within the live chat widget.
The function returns:
The article payload consists in:
customerly.load({ app_id: "REPLACE_APP_ID", callbacks: { onHelpCenterArticleOpened: function( article ) { … }, } });