diff --git a/app/javascript/dashboard/components/layout/sidebarComponents/Primary.vue b/app/javascript/dashboard/components/layout/sidebarComponents/Primary.vue index d2a9db3af..e6b5d0585 100644 --- a/app/javascript/dashboard/components/layout/sidebarComponents/Primary.vue +++ b/app/javascript/dashboard/components/layout/sidebarComponents/Primary.vue @@ -46,6 +46,7 @@ import AgentDetails from './AgentDetails'; import NotificationBell from './NotificationBell'; import wootConstants from 'dashboard/constants/globals'; import { frontendURL } from 'dashboard/helper/URLHelper'; +import { ACCOUNT_EVENTS } from '../../../helper/AnalyticsHelper/events'; export default { components: { @@ -99,6 +100,7 @@ export default { window.$chatwoot.toggle(); }, openNotificationPanel() { + this.$track(ACCOUNT_EVENTS.OPENED_NOTIFICATIONS); this.$emit('open-notification-panel'); }, }, diff --git a/app/javascript/dashboard/helper/AnalyticsHelper/events.js b/app/javascript/dashboard/helper/AnalyticsHelper/events.js index cd39d40ca..8ece9f648 100644 --- a/app/javascript/dashboard/helper/AnalyticsHelper/events.js +++ b/app/javascript/dashboard/helper/AnalyticsHelper/events.js @@ -15,6 +15,9 @@ export const ACCOUNT_EVENTS = Object.freeze({ ADDED_A_CUSTOM_ATTRIBUTE: 'Added a custom attribute', ADDED_AN_INBOX: 'Added an inbox', OPEN_MESSAGE_CONTEXT_MENU: 'Opened message context menu', + OPENED_NOTIFICATIONS: 'Opened notifications', + MARK_AS_READ_NOTIFICATIONS: 'Marked notifications as read', + OPEN_CONVERSATION_VIA_NOTIFICATION: 'Opened conversation via notification', }); export const LABEL_EVENTS = Object.freeze({ diff --git a/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationPanel.vue b/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationPanel.vue index 20d5e4600..4ed064139 100644 --- a/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationPanel.vue +++ b/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationPanel.vue @@ -116,9 +116,10 @@ import { mapGetters } from 'vuex'; import { mixin as clickaway } from 'vue-clickaway'; import rtlMixin from 'shared/mixins/rtlMixin'; - import NotificationPanelList from './NotificationPanelList'; +import { ACCOUNT_EVENTS } from '../../../../helper/AnalyticsHelper/events'; + export default { components: { NotificationPanelList, @@ -179,8 +180,12 @@ export default { primary_actor_id: primaryActorId, primary_actor_type: primaryActorType, primary_actor: { id: conversationId }, + notification_type: notificationType, } = notification; + this.$track(ACCOUNT_EVENTS.OPEN_CONVERSATION_VIA_NOTIFICATION, { + notificationType, + }); this.$store.dispatch('notifications/read', { primaryActorId, primaryActorType, @@ -217,6 +222,7 @@ export default { } }, onMarkAllDoneClick() { + this.$track(ACCOUNT_EVENTS.MARK_AS_READ_NOTIFICATIONS); this.$store.dispatch('notifications/readAll'); }, openAudioNotificationSettings() { diff --git a/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationsView.vue b/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationsView.vue index ca60b3750..5114c86b2 100644 --- a/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationsView.vue +++ b/app/javascript/dashboard/routes/dashboard/notifications/components/NotificationsView.vue @@ -22,6 +22,8 @@ import { mapGetters } from 'vuex'; import TableFooter from 'dashboard/components/widgets/TableFooter'; import NotificationTable from './NotificationTable'; + +import { ACCOUNT_EVENTS } from '../../../../helper/AnalyticsHelper/events'; export default { components: { NotificationTable, @@ -48,8 +50,12 @@ export default { primary_actor_id: primaryActorId, primary_actor_type: primaryActorType, primary_actor: { id: conversationId }, + notification_type: notificationType, } = notification; + this.$track(ACCOUNT_EVENTS.OPEN_CONVERSATION_VIA_NOTIFICATION, { + notificationType, + }); this.$store.dispatch('notifications/read', { primaryActorId, primaryActorType, @@ -61,6 +67,7 @@ export default { ); }, onMarkAllDoneClick() { + this.$track(ACCOUNT_EVENTS.MARK_AS_READ_NOTIFICATIONS); this.$store.dispatch('notifications/readAll'); }, },