Files
speckle-server/packages/frontend-2/lib/core/composables/mp.ts
T
Kristaps Fabians Geikins 2e272b321e feat(fe2): fix mp.reset() usage to avoid too many distinct ids + utm tracking not working on homepage (#2851)
* reset() fix

* fix(fe2): utm tracking on homepage route
2024-09-03 10:49:27 +03:00

22 lines
483 B
TypeScript

/**
* Get Mixpanel instance
*/
export function useMixpanel() {
const nuxt = useNuxtApp()
const $mixpanel = nuxt.$mixpanel
return $mixpanel()
}
/**
* Get Mixpanel instance on demand. Useful in early app bootstrapping situations where mixpanel may not be
* immediately available
*/
export const useDeferredMixpanel = () => {
const nuxt = useNuxtApp()
return () => {
const $mixpanel = nuxt.$mixpanel
if (!$mixpanel) return undefined
return $mixpanel()
}
}