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.

Event Description
button_hidden Button was not displayed
button_displayed Button was displayed
chat_requested Button was clicked to start a chat session
window_visible The chat window becomes visible
window_invisible The chat window becomes invisible
proactive_timer Proactive timer started
proactive_unavailable Proative timer finished and slot available
proactive_offer Proactive timer finished and greeting message sent
proactive_reject Webvisitor closed proactive window
slot_check Check if there is an empty chat slot
slot_available Slot is available
slot_unavailable No slot available
slot_connect Request slot
error_message An error happened and was presented to the user
offline_mode Chat is offline
offline_form_show Offline form was shown
offline_view_show Offline message was shown
offline_form_submit Offline message form was submitted
chat_butler Chat Butler program was started
chat_butler_connect Chat Buttler tried to connect to an Operator
chat_butler_cancel Chat Butler program was canceled
facebook_login_timeout Facebook login ran into a timeout and was skipped
facebook_login_status_response Facebook login status request delivered a response
facebook_login_success Facebook login was successful
facebook_login_failure Facebook login failed
facebook_me_response Facebook Graph API me delivered a response
register_show Register view was shown
register_cancel Register flow was canceled by the Webvisitor
register_submit Register flow was finished
group_select_show Group Select view was shown
group_select_cancel Group Select flow was canceled by the Webvisitor
group_select_submit Group Select flow was finished
pre_survey_show Pre-chat survey was shown
pre_survey_cancel Pre-chat survey was canceled
pre_survey_submit Pre-chat survey was submitted
disclaimer_show Data privacy notice was shown
disclaimer_cancel Data privacy notice was canceled
disclaimer_ok Data privacy notice was accepted
rating_show Star rating view was shown
rating_cancel Star rating was canceled
rating_submit Feedback was submitted
feedback_show Feedback view was shown
feedback_cancel Feedback was canceled
feedback_submit Star feedback was submitted
post_survey_show Post-chat survey was shown
post_survey_cancel Post-chat survey was canceled
post_survey_submit Post-chat survey was submitted
facebook_like_show Facebook like view was shown
facebook_like_cancel Facebook like view was canceled
twitter_tweet_show Twitter tweet view was shown
twitter_tweet_tweeted Webvisitor tweeted a message
twitter_tweet_cancel Twitter tweet view was canceled
chat_passive_connect Chat session is started but not yet connected to an Operator
chat_connected Chat session is connected to the Operator
chat_connected_proactive Chat session initiated by a proactive offer is connected to the Operator
chat_started Chat started, Webvisitor has sent a message
chat_started_proactive Chat that is initiated by a proactive offer, is started, Webvisitor has sent a message
chat_quit Chat session was terminated
chat_window_minimzed Chat window was minimzed
chat_window_maximized Chat window was maximized
chat_reconnect Chat session was reconnected on new page
message_operator_terminating Chat message sent to Operator
message_client_terminating Chat message was sent to the client from the Operator
message_client_terminating_first First 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.

Name Type Description Optional
client_uuid String Unique ID of the Webvisitor
operator_group_id Integer ID of the Operator group connected to the current Chat Widget
widget_id Integer ID of the current Chat Widget
widget_lang String ISO 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.

Name Type Description Optional
session_id String Session ID per browser session
chat_id String Chat ID which relates to the chat transcripts
client_name String Name of the Webvisitor
client_email String Email of the Webvisitor
operator_id Integer Operator ID of the current chat session
operator_name String Operator name of the current chat session
custom_data Object Your currently assigned custom data
duration Float The duration of the chat in seconds between chat_started and chat_quit

Sample Code

Here is sample using Google Analytics as a tracking backend.