mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Client Analytics (#9023)
* start to refactor analytics and some mixins * wip * wip * wip * more analytics * more analytics * more anlytics * fix analytics module * finish analytics * fix env * vue casing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import getStore from 'client/store';
|
||||
import * as Analytics from 'client/libs/analytics';
|
||||
|
||||
// import EmptyView from './components/emptyView';
|
||||
|
||||
@@ -14,7 +15,7 @@ const CommunityGuidelinesPage = () => import(/* webpackChunkName: "static" */'./
|
||||
const ContactPage = () => import(/* webpackChunkName: "static" */'./components/static/contact');
|
||||
const FAQPage = () => import(/* webpackChunkName: "static" */'./components/static/faq');
|
||||
const FeaturesPage = () => import(/* webpackChunkName: "static" */'./components/static/features');
|
||||
const FrontPage = () => import(/* webpackChunkName: "static" */'./components/static/front');
|
||||
const HomePage = () => import(/* webpackChunkName: "static" */'./components/static/home');
|
||||
const GroupPlansPage = () => import(/* webpackChunkName: "static" */'./components/static/groupPlans');
|
||||
const MaintenancePage = () => import(/* webpackChunkName: "static" */'./components/static/maintenance');
|
||||
const MaintenanceInfoPage = () => import(/* webpackChunkName: "static" */'./components/static/maintenanceInfo');
|
||||
@@ -99,7 +100,7 @@ const router = new VueRouter({
|
||||
},
|
||||
// requiresLogin is true by default, isStatic false
|
||||
routes: [
|
||||
{ name: 'home', path: '/home', component: FrontPage, meta: {requiresLogin: false} },
|
||||
{ name: 'home', path: '/home', component: HomePage, meta: {requiresLogin: false} },
|
||||
{ name: 'register', path: '/register', component: RegisterLogin, meta: {requiresLogin: false} },
|
||||
{ name: 'login', path: '/login', component: RegisterLogin, meta: {requiresLogin: false} },
|
||||
{ name: 'tasks', path: '/', component: UserTasks },
|
||||
@@ -287,6 +288,13 @@ router.beforeEach(function routerGuard (to, from, next) {
|
||||
return next({name: 'tasks'});
|
||||
}
|
||||
|
||||
Analytics.track({
|
||||
hitType: 'pageview',
|
||||
eventCategory: 'navigation',
|
||||
eventAction: 'navigate',
|
||||
page: to.name || to.path,
|
||||
});
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user