Client Tracking API Tutorial
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.
Event | Description |
---|---|
button_displayed
|
Chat button displayed to contact on your website |
chat_connected
|
Widget connected to Userlike server after contact clicked the chat button |
chat_connected_proactive
|
Widget connected to Userlike server proactively |
chat_requested
|
Chat button clicked by contact to start a conversation |
chat_started
|
Conversation started, contact sent a message |
chat_started_proactive
|
Conversation started proactively, contact sent a message |
chat_window_maximized
|
Contact maximized the Website Messenger |
chat_window_minimized
|
Contact minimized the Website Messenger |
contact_first_message
|
First message sent by contact |
conversation_resume
|
Contact opened conversation from overview or did a reload |
disclaimer_ok
|
Contact accepted data privacy notice |
error_message
|
Error message displayed to contact |
feedback_rating_cancel
|
Contact cancelled star rating and feedback view |
feedback_rating_show
|
Star rating and feedback view displayed to contact |
feedback_submit
|
Contact submitted feedback |
group_select_show
|
Group Select view displayed to contact |
group_select_submit
|
Contact selected operator group, Widget connected to Userlike server |
message_client_terminating
|
Operator sent message to contact |
message_operator_terminating
|
Contact sent message to operator |
post_survey_show
|
Post-chat survey was shown |
post_survey_submit
|
Post-chat survey was submitted |
pre_survey_show
|
Pre-chat survey was shown |
pre_survey_submit
|
Pre-chat survey was submitted |
proactive_offer
|
Proactive timer started (Messenger opens after timer runs down) |
proactive_timer
|
Proactive timer started, after which the UM widget will be opened proactively |
rating_submit
|
Contact submitted chat rating |
register_cancel
|
Contact cancelled register flow |
register_show
|
Register view was shown |
register_submit
|
Register flow was finished |
slot_available
|
Userlike checked for free chat slots and found one |
slot_check
|
Userlike checked for free chat slots |
slot_unavailable
|
Userlike checked for free chat slots and found none |
transcript_cancel
|
Contact rejected transcript offer |
transcript_show
|
Contact was offered to receive transcript vie email |
transcript_submit
|
Contact accepted transcript offer |
Global context
The function argument “global_ctx” is a JavaScript object that will have the following values:
Name | Type | Description | Optional |
---|---|---|---|
client_uuid
|
String | Unique ID of the contact | |
operator_group_id
|
Integer | ID of the operator group connected to the Widget | |
widget_id
|
Integer | ID of the Widget | |
widget_lang
|
String | ISO 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.
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 contact | |
client_email
|
String | Email of the contact | |
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 |
Sample code
Here is sample using Google Analytics as a tracking backend.