Client tracking API

Integrate Userlike with your website tracking solution

If you’re already using a tracking solution for your website, you can integrate it with Userlike and track Userlike-specific events.

Provide a JavaScript callback function and Userlike’s chat client will send relevant tracking events.

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 string “event_name” can have the following values.

EventDescription
button_displayedChat button displayed to contact on your website
chat_connectedWidget connected to Userlike server after contact clicked the chat button
chat_connected_proactiveWidget connected to Userlike server proactively
chat_requestedChat button clicked by contact to start a conversation
chat_startedConversation started, contact sent a message
chat_started_proactiveConversation started proactively, contact sent a message
chat_window_maximizedContact maximized the Website Messenger
chat_window_minimizedContact minimized the Website Messenger
contact_first_messageFirst message sent by contact
conversation_resumeContact opened conversation from overview or did a reload
disclaimer_okContact accepted data privacy notice
error_messageError message displayed to contact
feedback_rating_cancelContact cancelled star rating and feedback view
feedback_rating_showStar rating and feedback view displayed to contact
feedback_submitContact submitted feedback
group_select_showGroup Select view displayed to contact
group_select_submitContact selected operator group, Widget connected to Userlike server
message_client_terminatingOperator sent message to contact
message_operator_terminatingContact sent message to operator
post_survey_showPost-chat survey was shown
post_survey_submitPost-chat survey was submitted
pre_survey_showPre-chat survey was shown
pre_survey_submitPre-chat survey was submitted
proactive_offerProactive timer started (Messenger opens after timer runs down)
proactive_timerProactive timer started, after which the UM widget will be opened proactively
rating_submitContact submitted chat rating
register_cancelContact cancelled register flow
register_showRegister view was shown
register_submitRegister flow was finished
slot_availableUserlike checked for free chat slots and found one
slot_checkUserlike checked for free chat slots
slot_unavailableUserlike checked for free chat slots and found none
transcript_cancelContact rejected transcript offer
transcript_showContact was offered to receive transcript vie email
transcript_submitContact accepted transcript offer

Global context

The function argument “global_ctx” is a JavaScript object that will have the following values:

NameTypeDescriptionOptional
client_uuidStringUnique ID of the contact
operator_group_idIntegerID of the operator group connected to the Widget
widget_idIntegerID of the Widget
widget_langStringISO 639-1 language code of the current Widget

Session context

The function argument “session_ctx” is a JavaScript object that will have the following values. Depending on the state and configuration of your Widget, values will be defined or undefined.

NameTypeDescriptionOptional
session_idStringSession ID per browser session
chat_idStringChat ID which relates to the chat transcripts
client_nameStringName of the contact
client_emailStringEmail of the contact
operator_idIntegerOperator ID of the current chat session
operator_nameStringOperator name of the current chat session
custom_dataObjectYour currently assigned custom data

Sample code

Here is sample using Google Analytics as a tracking backend.