From 54880b23427aecf9d0cc84487e557af6c2cef3af Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 24 Apr 2023 20:21:43 +0530 Subject: [PATCH] feat: Track conversation priority events (#6968) --- app/javascript/dashboard/components/ChatList.vue | 5 +++++ app/javascript/dashboard/helper/AnalyticsHelper/events.js | 1 + .../routes/dashboard/conversation/ConversationAction.vue | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 990ea9e02..c53dd926f 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -192,6 +192,7 @@ import { isOnMentionsView, isOnUnattendedView, } from '../store/modules/conversations/helpers/actionHelpers'; +import { CONVERSATION_EVENTS } from '../helper/AnalyticsHelper/events'; export default { components: { @@ -679,6 +680,10 @@ export default { this.$store .dispatch('assignPriority', { conversationId, priority }) .then(() => { + this.$track(CONVERSATION_EVENTS.CHANGE_PRIORITY, { + newValue: priority, + from: 'Context menu', + }); this.showAlert( this.$t('CONVERSATION.PRIORITY.CHANGE_PRIORITY.SUCCESSFUL', { priority, diff --git a/app/javascript/dashboard/helper/AnalyticsHelper/events.js b/app/javascript/dashboard/helper/AnalyticsHelper/events.js index f8615a30c..979120560 100644 --- a/app/javascript/dashboard/helper/AnalyticsHelper/events.js +++ b/app/javascript/dashboard/helper/AnalyticsHelper/events.js @@ -7,6 +7,7 @@ export const CONVERSATION_EVENTS = Object.freeze({ USED_MENTIONS: 'Used mentions', SEARCH_CONVERSATION: 'Searched conversations', APPLY_FILTER: 'Applied filters in the conversation list', + CHANGE_PRIORITY: 'Assigned priority to a conversation', }); export const ACCOUNT_EVENTS = Object.freeze({ diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationAction.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationAction.vue index c55ebed6a..6a4135d5b 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationAction.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationAction.vue @@ -88,6 +88,7 @@ import ConversationLabels from './labels/LabelBox.vue'; import agentMixin from 'dashboard/mixins/agentMixin'; import teamMixin from 'dashboard/mixins/conversation/teamMixin'; import { CONVERSATION_PRIORITY } from '../../../../shared/constants/messages'; +import { CONVERSATION_EVENTS } from '../../../helper/AnalyticsHelper/events'; export default { components: { @@ -184,7 +185,9 @@ export default { }, set(priorityItem) { const conversationId = this.currentChat.id; + const oldValue = this.currentChat?.priority; const priority = priorityItem ? priorityItem.id : null; + this.$store.dispatch('setCurrentChatPriority', { priority, conversationId, @@ -192,6 +195,11 @@ export default { this.$store .dispatch('assignPriority', { conversationId, priority }) .then(() => { + this.$track(CONVERSATION_EVENTS.CHANGE_PRIORITY, { + oldValue, + newValue: priority, + from: 'Conversation Sidebar', + }); this.showAlert( this.$t('CONVERSATION.PRIORITY.CHANGE_PRIORITY.SUCCESSFUL', { priority: priorityItem.name,