Tracking API Tutorial

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 for 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.

chat_requestedButton was clicked to start a chat session
chat_startedChat started, Webvisitor has sent a message
chat_window_maximizedChat window was maximized
chat_window_minimzedChat window was minimzed
contact_first_messageFirst message sent by Contact
conversation_resumeContact opened COnversation from overview or did a reload
disclaimer_okData privacy notice was accepted
error_messageAn error happened and was presented to the user
feedback_rating_cancelStar rating and feedback was canceled
feedback_rating_showStar rating and feedback view was shown
feedback_submitFeedback was submitted
group_select_showGroup Select view was shown
group_select_submitGroup Select flow was finished
message_client_terminatingChat message was sent to the client from the Operator
message_operator_terminatingChat message sent 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_timerProactive timer started
rating_submitStar rating was submitted
register_cancelRegister flow was canceled by the Webvisitor
register_showRegister view was shown
register_submitRegister flow was finished
slot_availableSlot is available
slot_checkCheck if there is an empty chat slot
slot_unavailableNo slot available
social_composite_cancelSocial media view was canceled
social_composite_showSocial media view was shown
transcript_cancelContact rejected transcript offer
transcript_showContact is offered to receive transcript vie email
transcript_submitContact accepted transcript offer
twitter_tweet_tweetedWebvisitor tweeted a message

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

Sample Code

Here is sample using Google Analytics as a tracking backend.