feat: Add analytics events for notification feature (#7749)

This commit is contained in:
Muhsin Keloth
2023-08-17 21:48:31 +05:30
committed by GitHub
parent 996f842882
commit 12ae49089b
4 changed files with 19 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ import AgentDetails from './AgentDetails';
import NotificationBell from './NotificationBell'; import NotificationBell from './NotificationBell';
import wootConstants from 'dashboard/constants/globals'; import wootConstants from 'dashboard/constants/globals';
import { frontendURL } from 'dashboard/helper/URLHelper'; import { frontendURL } from 'dashboard/helper/URLHelper';
import { ACCOUNT_EVENTS } from '../../../helper/AnalyticsHelper/events';
export default { export default {
components: { components: {
@@ -99,6 +100,7 @@ export default {
window.$chatwoot.toggle(); window.$chatwoot.toggle();
}, },
openNotificationPanel() { openNotificationPanel() {
this.$track(ACCOUNT_EVENTS.OPENED_NOTIFICATIONS);
this.$emit('open-notification-panel'); this.$emit('open-notification-panel');
}, },
}, },

View File

@@ -15,6 +15,9 @@ export const ACCOUNT_EVENTS = Object.freeze({
ADDED_A_CUSTOM_ATTRIBUTE: 'Added a custom attribute', ADDED_A_CUSTOM_ATTRIBUTE: 'Added a custom attribute',
ADDED_AN_INBOX: 'Added an inbox', ADDED_AN_INBOX: 'Added an inbox',
OPEN_MESSAGE_CONTEXT_MENU: 'Opened message context menu', 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({ export const LABEL_EVENTS = Object.freeze({

View File

@@ -116,9 +116,10 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { mixin as clickaway } from 'vue-clickaway'; import { mixin as clickaway } from 'vue-clickaway';
import rtlMixin from 'shared/mixins/rtlMixin'; import rtlMixin from 'shared/mixins/rtlMixin';
import NotificationPanelList from './NotificationPanelList'; import NotificationPanelList from './NotificationPanelList';
import { ACCOUNT_EVENTS } from '../../../../helper/AnalyticsHelper/events';
export default { export default {
components: { components: {
NotificationPanelList, NotificationPanelList,
@@ -179,8 +180,12 @@ export default {
primary_actor_id: primaryActorId, primary_actor_id: primaryActorId,
primary_actor_type: primaryActorType, primary_actor_type: primaryActorType,
primary_actor: { id: conversationId }, primary_actor: { id: conversationId },
notification_type: notificationType,
} = notification; } = notification;
this.$track(ACCOUNT_EVENTS.OPEN_CONVERSATION_VIA_NOTIFICATION, {
notificationType,
});
this.$store.dispatch('notifications/read', { this.$store.dispatch('notifications/read', {
primaryActorId, primaryActorId,
primaryActorType, primaryActorType,
@@ -217,6 +222,7 @@ export default {
} }
}, },
onMarkAllDoneClick() { onMarkAllDoneClick() {
this.$track(ACCOUNT_EVENTS.MARK_AS_READ_NOTIFICATIONS);
this.$store.dispatch('notifications/readAll'); this.$store.dispatch('notifications/readAll');
}, },
openAudioNotificationSettings() { openAudioNotificationSettings() {

View File

@@ -22,6 +22,8 @@ import { mapGetters } from 'vuex';
import TableFooter from 'dashboard/components/widgets/TableFooter'; import TableFooter from 'dashboard/components/widgets/TableFooter';
import NotificationTable from './NotificationTable'; import NotificationTable from './NotificationTable';
import { ACCOUNT_EVENTS } from '../../../../helper/AnalyticsHelper/events';
export default { export default {
components: { components: {
NotificationTable, NotificationTable,
@@ -48,8 +50,12 @@ export default {
primary_actor_id: primaryActorId, primary_actor_id: primaryActorId,
primary_actor_type: primaryActorType, primary_actor_type: primaryActorType,
primary_actor: { id: conversationId }, primary_actor: { id: conversationId },
notification_type: notificationType,
} = notification; } = notification;
this.$track(ACCOUNT_EVENTS.OPEN_CONVERSATION_VIA_NOTIFICATION, {
notificationType,
});
this.$store.dispatch('notifications/read', { this.$store.dispatch('notifications/read', {
primaryActorId, primaryActorId,
primaryActorType, primaryActorType,
@@ -61,6 +67,7 @@ export default {
); );
}, },
onMarkAllDoneClick() { onMarkAllDoneClick() {
this.$track(ACCOUNT_EVENTS.MARK_AS_READ_NOTIFICATIONS);
this.$store.dispatch('notifications/readAll'); this.$store.dispatch('notifications/readAll');
}, },
}, },