diff --git a/apps/stage-tamagotchi/src/renderer/main.ts b/apps/stage-tamagotchi/src/renderer/main.ts index 197b56caf..88d03a431 100644 --- a/apps/stage-tamagotchi/src/renderer/main.ts +++ b/apps/stage-tamagotchi/src/renderer/main.ts @@ -2,9 +2,13 @@ import type { Plugin } from 'vue' import type { RouteRecordRaw } from 'vue-router' import Tres from '@tresjs/core' +import buildTime from '~build/time' import { autoAnimatePlugin } from '@formkit/auto-animate/vue' +import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics' import { MotionPlugin } from '@vueuse/motion' +import { abbreviatedSha, branch } from '~build/git' +import { version } from '~build/package' import { createPinia } from 'pinia' import { setupLayouts } from 'virtual:generated-layouts' import { createApp } from 'vue' @@ -38,6 +42,15 @@ import '@fontsource/sniglet' const pinia = createPinia() +// Initialize analytics +const analyticsStore = useSharedAnalyticsStore(pinia) +analyticsStore.initialize({ + version: version ?? 'dev', + commit: abbreviatedSha, + branch, + builtOn: buildTime.toISOString(), +}) + const router = createRouter({ history: createWebHashHistory(), // TODO: vite-plugin-vue-layouts is long deprecated, replace with another layout solution diff --git a/apps/stage-tamagotchi/src/renderer/modules/posthog.ts b/apps/stage-tamagotchi/src/renderer/modules/posthog.ts index caab627a4..c27aecddf 100644 --- a/apps/stage-tamagotchi/src/renderer/modules/posthog.ts +++ b/apps/stage-tamagotchi/src/renderer/modules/posthog.ts @@ -1,16 +1,6 @@ -import buildTime from '~build/time' import posthog from 'posthog-js' -import { abbreviatedSha } from '~build/git' -import { version } from '~build/package' - posthog.init('phc_rljw376z5gt6vXJlc3sTr7hFbXodciY9THEQXIRnW53', { api_host: 'https://us.i.posthog.com', person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well }) - -posthog.register({ - app_version: version ?? 'dev', - app_commit: abbreviatedSha, - app_build_time: buildTime, -}) diff --git a/apps/stage-tamagotchi/src/renderer/pages/about.vue b/apps/stage-tamagotchi/src/renderer/pages/about.vue index 48fd4d9a3..a19867b8a 100644 --- a/apps/stage-tamagotchi/src/renderer/pages/about.vue +++ b/apps/stage-tamagotchi/src/renderer/pages/about.vue @@ -1,24 +1,17 @@