Skip to content

Commit 50f4523

Browse files
authored
Add RUM events for Docs AI dashboard (#35932)
* Add RUM instrumentation for Docs AI leadership dashboard Add impression and conversation close events to enable reporting on chatbot adoption and engagement metrics. * Label keyboard-enter AI suggestion trigger as search_suggestion The keyboard path in instantsearch.js was missing a source, defaulting to entry_button. Align with the click path.
1 parent b31d3f4 commit 50f4523

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

assets/scripts/components/conversational-search/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ initializeFeatureFlags().then(async (client) => {
5353

5454
if (IS_CONVERSATIONAL_SEARCH_ENABLED) {
5555
document.body.classList.add('conv-search-enabled');
56+
logAction('Conversational Search Impression', {
57+
conversational_search: { action: 'impression', page: window.location.pathname }
58+
});
5659
initConversationalSearch();
5760
}
5861
});
@@ -322,6 +325,14 @@ class ConversationalSearch {
322325
}
323326

324327
close() {
328+
const messageCount = this.chatHistory.filter(m => m.role === 'user').length;
329+
if (messageCount > 0) {
330+
this.logInteraction('conversation_close', {
331+
messages_sent: messageCount,
332+
responses_received: this.chatHistory.filter(m => m.role === 'assistant').length
333+
});
334+
}
335+
325336
this.isOpen = false;
326337
this.sidebar.classList.remove('open');
327338
this.overlay.classList.remove('open');

assets/scripts/components/instantsearch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function loadInstantSearch(currentPageWasAsyncLoaded) {
358358
if (selectedItem?.classList.contains('ais-Hits-ai-suggestion')) {
359359
const query = selectedItem.dataset.query || aisSearchBoxInput.value;
360360
if (window.askDocsAI) {
361-
window.askDocsAI(query);
361+
window.askDocsAI(query, { source: 'search_suggestion' });
362362
// Hide the search dropdown
363363
hitsContainerContainer.classList.add('d-none');
364364
searchBoxContainerContainer.classList.remove('active-search');

0 commit comments

Comments
 (0)