Files
speckle-server/packages/frontend-2/plugins/080-mp.client.ts
T
Kristaps Fabians Geikins a6a4ceee86 feat: true-myth result structures & other auth policy improvements (#4262)
* fixing up typing

* better dynamic loader mechanism

* buildReqLoaders cleanup

* added caching to loaders

* ensuring all loaders are async

* fe2 plugins error handling fix

* feat(shared): true-myth result structures & other auth policy improvements

* moving workspaceCore loaders to correct place
2025-03-25 17:49:02 +01:00

31 lines
734 B
TypeScript

import { useMixpanel } from '~/lib/core/composables/mp'
import type { RouteLocationNormalized } from 'vue-router'
import type { Optional } from '@speckle/shared'
export default defineNuxtPlugin(() => {
const mp = useMixpanel()
const router = useRouter()
const route = useRoute()
let previousPath: Optional<string> = undefined
const track = (to: RouteLocationNormalized) => {
const path = to.path
if (path === previousPath) return
const pathDefinition = getRouteDefinition(to)
mp.track('Route Visited', {
path,
pathDefinition
})
previousPath = path
}
// Track init page view
track(route)
// Track page view after navigations
router.afterEach((to) => {
track(to)
})
})