Add your own analytics
Use our callback function to log events from the search and chat widgets to your own analytics tool.
Scenario
To understand how usage of the Inkeep search or chat affects your business, you may want to log events from the search and chat widgets to your own analytics tool. This could be Mixpanel, Posthog, Amplitude, Segment or other analytics or CDP tools.
We expose all the events that we log to our own analytics suite through a callback function called logEventCallback
that can be configured in the baseSettings
configuration.
Below is an example of how to use logEventCallback
to log events related to the chat_message_bot_response_received
event to your analytics tool. You can check out the full reference of events by inspecting the InkeepCallbackEvent
type in the npm package.
We recommend you only log the events and properties on the events that you find relevant.
Example
Available events
Accessible via the eventName
property on the InkeepCallbackEvent
type.
Event name | Description |
---|---|
chat_message_submitted | User submits a chat message |
chat_message_bot_response_received | Bot response to user message is received |
search_query_submitted | Search query is submitted |
search_query_response_received | Response to search query is received |
search_result_clicked | Search result is clicked |
chat_thumbs_up_feedback_submitted | User submits thumbs up feedback |
chat_thumbs_down_feedback_submitted | User submits thumbs down feedback |
chat_history_cleared | Chat history is cleared |
chat_share_button_clicked | Share button is clicked |
chat_message_copied | Chat message is copied |
chat_code_block_copied | Code block in chat is copied |
chat_response_citation_clicked | Citation link is clicked |
get_help_option_clicked | Get help item is clicked |
support_button_clicked | Support button (if configured as part of the aiAnnotationPolicies) is clicked |
Common properties
The below are shared by all events.
Property name | Description |
---|---|
organization_id | Organization ID |
widgetLibraryVersion | Widget library version |
interactionType | Type of interaction. Value can be one of 'EMBEDDED_CHAT' | 'CHAT_BUTTON' | 'CUSTOM_TRIGGER' | 'SEARCH_BAR' . |
User props
If provided to the React component, the below user properties are available.
Property name | Description |
---|---|
userIdentificationType | How user is identified. Can be of values 'ANONYMOUS' | 'COOKIED' | 'ID_PROVIDED' depending on analytics configuration. |
userCohorts | User cohorts |
userEmail | User email |
Chat properties
The below are shared by all chat events.
Property name | Description |
---|---|
chatModeCurrentlySelected | Currently selected chat mode |
chatSessionId | ID of shared chat session |