Userlike chat Event Listener
How to track Userlike chat interactions with google tag manager
Seamlessly push user interactions with your Userlike chat widget to your analytics tools (Google Analytics, Heap, Piwik Pro, Mixpanel).
Implementing this, you’ll create a new custom HTML tag, copy and paste the Chaport event listener in the tag
Add a trigger and fire in on DOM ready or Window Loaded.
Next is to create a custom event with the event name [Userlike_Action], which triggers on all chaport Events.
For more information on the specific event that occurred, create a dataLayer variables with the following keys;
[ChatAction] –> returns 35 different event names, like chat_connected, chat_started, chat_window_maximized, pre_survey_submit, etc.
[ChatWidgetID] –> ID of the Widget
[ChatOperatorID] –> Operator ID of the current chat session
[ChatUserID] –> Unique ID of the contact
[ChatwidgetLanguage] –> language code of the current Widget
[Userlanguage] –> the user browser language
[ChatID] –> Chat ID which relates to the chat transcripts
[ChatSessionID] –> Session ID per browser session
To start sending data to your analytics tools, you’ll have to create the appropriate tag and attach the [Userlike_Action] trigger you created.
Also, you can streamline your trigger to fire for specific chat interactions by using trigger conditions and dataLayer variables such as [ChatAction]
With this data in your analytics, you can measure how these chat interactions impact conversions, your marketing funnel and other business KPIs.
<script> userlikeTrackingEvent = function (event_name, global_ctx, session_ctx) { window.dataLayer.push({ event: "Userlike_Action", ChatAction: event_name, ChatWidgetID: global_ctx.widget_id, ChatOperatorID: session_ctx.operator_id, ChatUserID: global_ctx.client_uuid, ChatwidgetLanguage: global_ctx.widget_lang, Userlanguage: navigator.language, ChatID: session_ctx.chat_id, ChatSessionID: session_ctx.session_id }); }; </script>