Tracking API Tutorial

This tutorial refers to Userlike’s live chat product. For Userlike’s Unified Messaging tutorials, click here.

Integrate with your website tracking solution

If you are already using a website tracking solution for your website you might be interested in adding Userlike specific interactions to your tracking. You can integrate any website tracking solution with Userlike. The Userlike chat client will send relevant tracking events to a Javascript callback function that you need to provide. Define a function named userlikeTrackingEvent to receive the events. In your function you need to implement a specific tracking call to your tracking system.

Before you start

  • Due to limitations of client based tracking (e.g. ad blockers) the data cannot be compared to our backend based solution Userlike Analytics.
  • This is an advanced feature, which needs to be implemented by your development team.

Event Names

The function argument event_name is a string that can have following values.

button_hiddenButton was not displayed
button_displayedButton was displayed
chat_requestedButton was clicked to start a chat session
window_visibleThe chat window becomes visible
window_invisibleThe chat window becomes invisible
proactive_timerProactive timer started
proactive_unavailableProative timer finished and slot available
proactive_offerProactive timer finished and greeting message sent
proactive_rejectWebvisitor closed proactive window
slot_checkCheck if there is an empty chat slot
slot_availableSlot is available
slot_unavailableNo slot available
slot_connectRequest slot
error_messageAn error happened and was presented to the user
offline_modeChat is offline
offline_form_showOffline form was shown
offline_view_showOffline message was shown
offline_form_submitOffline message form was submitted
chat_butlerChat Butler program was started
chat_butler_connectChat Buttler tried to connect to an Operator
chat_butler_cancelChat Butler program was canceled
facebook_login_timeoutFacebook login ran into a timeout and was skipped
facebook_login_status_responseFacebook login status request delivered a response
facebook_login_successFacebook login was successful
facebook_login_failureFacebook login failed
facebook_me_responseFacebook Graph API me delivered a response
register_showRegister view was shown
register_cancelRegister flow was canceled by the Webvisitor
register_submitRegister flow was finished
group_select_showGroup Select view was shown
group_select_cancelGroup Select flow was canceled by the Webvisitor
group_select_submitGroup Select flow was finished
pre_survey_showPre-chat survey was shown
pre_survey_cancelPre-chat survey was canceled
pre_survey_submitPre-chat survey was submitted
disclaimer_showData privacy notice was shown
disclaimer_cancelData privacy notice was canceled
disclaimer_okData privacy notice was accepted
rating_showStar rating view was shown
rating_cancelStar rating was canceled
rating_submitFeedback was submitted
feedback_showFeedback view was shown
feedback_cancelFeedback was canceled
feedback_submitStar feedback was submitted
post_survey_showPost-chat survey was shown
post_survey_cancelPost-chat survey was canceled
post_survey_submitPost-chat survey was submitted
facebook_like_showFacebook like view was shown
facebook_like_cancelFacebook like view was canceled
twitter_tweet_showTwitter tweet view was shown
twitter_tweet_tweetedWebvisitor tweeted a message
twitter_tweet_cancelTwitter tweet view was canceled
chat_passive_connectChat session is started but not yet connected to an Operator
chat_connectedChat session is connected to the Operator
chat_connected_proactiveChat session initiated by a proactive offer is connected to the Operator
chat_startedChat started, Webvisitor has sent a message
chat_started_proactiveChat that is initiated by a proactive offer, is started, Webvisitor has sent a message
chat_quitChat session was terminated
chat_window_minimzedChat window was minimzed
chat_window_maximizedChat window was maximized
chat_reconnectChat session was reconnected on new page
message_operator_terminatingChat message sent to Operator
message_client_terminatingChat message was sent to the client from the Operator
message_client_terminating_firstFirst chat message was sent to the client from the Operator

Global Context

The function argument "global_ctx" is a Javascript object that will have these values.

client_uuidStringUnique ID of the Webvisitor
operator_group_idIntegerID of the Operator group connected to the current Chat Widget
widget_idIntegerID of the current Chat Widget
widget_langStringISO 639-1 language code of the current Chat Widget

Session Context

The function argument "session_ctx" is a Javascript object that will have these values. Depending on the state and configuration of the Chat Widget, values will be defined or undefined.

session_idStringSession ID per browser session
chat_idStringChat ID which relates to the chat transcripts
client_nameStringName of the Webvisitor
client_emailStringEmail of the Webvisitor
operator_idIntegerOperator ID of the current chat session
operator_nameStringOperator name of the current chat session
custom_dataObjectYour currently assigned custom data
durationFloatThe duration of the chat in seconds between chat_started and chat_quit

Sample Code

Here is sample using Google Analytics as a tracking backend.