mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: Integrate LogRocket (#6494)
* feat: install logrocket * feat: allow log rocket * feat: enable vuex log-rocket * feat: integrate vuex with log rocket * feat: add log rocket identify * fix: identify if log rocket is initialized --------- Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import AnalyticsHelper from './AnalyticsHelper';
|
||||
import LogRocket from 'logrocket';
|
||||
import DashboardAudioNotificationHelper from './AudioAlerts/DashboardAudioNotificationHelper';
|
||||
|
||||
export const CHATWOOT_SET_USER = 'CHATWOOT_SET_USER';
|
||||
@@ -10,6 +11,12 @@ export const ANALYTICS_RESET = 'ANALYTICS_RESET';
|
||||
export const initializeAnalyticsEvents = () => {
|
||||
window.bus.$on(ANALYTICS_IDENTITY, ({ user }) => {
|
||||
AnalyticsHelper.identify(user);
|
||||
if (window.logRocketProjectId) {
|
||||
LogRocket.identify(user.id, {
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
window.bus.$on(ANALYTICS_RESET, () => {});
|
||||
};
|
||||
|
||||
@@ -42,6 +42,25 @@ import teams from './modules/teams';
|
||||
import userNotificationSettings from './modules/userNotificationSettings';
|
||||
import webhooks from './modules/webhooks';
|
||||
|
||||
import LogRocket from 'logrocket';
|
||||
import createPlugin from 'logrocket-vuex';
|
||||
|
||||
const plugins = [];
|
||||
|
||||
if (window.logRocketProjectId) {
|
||||
LogRocket.init(window.logRocketProjectId);
|
||||
const logRocketPlugin = createPlugin(LogRocket, function(mutation) {
|
||||
const eventsToIgnore = ['SET_CURRENT_USER', 'AUTHENTICATE', 'CLEAR_USER'];
|
||||
if (eventsToIgnore.includes(mutation.type)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return mutation;
|
||||
});
|
||||
|
||||
plugins.push(logRocketPlugin);
|
||||
}
|
||||
|
||||
Vue.use(Vuex);
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
@@ -86,4 +105,5 @@ export default new Vuex.Store({
|
||||
userNotificationSettings,
|
||||
webhooks,
|
||||
},
|
||||
plugins,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user