diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-02-25 20:51:23 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-25 11:51:23 +0000 |
| commit | 2b6638e1607e5c44eb6f6dc987e9e893927f1829 (patch) | |
| tree | f3efba7ca978bd5cf7d32202a014ffb73ac719f6 /packages/frontend/src/boot | |
| parent | chore(config): migrate renovate config (#15550) (diff) | |
| download | sharkey-2b6638e1607e5c44eb6f6dc987e9e893927f1829.tar.gz sharkey-2b6638e1607e5c44eb6f6dc987e9e893927f1829.tar.bz2 sharkey-2b6638e1607e5c44eb6f6dc987e9e893927f1829.zip | |
feat: google analytics (#15451)
* wip backend
* wip frontend
* build misskey-js
* implement control panel
* fix
* introduce analytics wrapper
* spdx
* Update analytics.ts
* Update common.ts
* wip
* wip
* wip
* wip
* wip
* Update CHANGELOG.md
---------
Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/boot')
| -rw-r--r-- | packages/frontend/src/boot/common.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 1d8e40a12d..d09b98efe0 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -4,9 +4,9 @@ */ import { computed, watch, version as vueVersion } from 'vue'; -import type { App } from 'vue'; import { compareVersions } from 'compare-versions'; import { version, lang, updateLocale, locale } from '@@/js/config.js'; +import type { App } from 'vue'; import widgets from '@/widgets/index.js'; import directives from '@/directives/index.js'; import components from '@/components/index.js'; @@ -21,6 +21,7 @@ import { reloadChannel } from '@/scripts/unison-reload.js'; import { getUrlWithoutLoginId } from '@/scripts/login-id.js'; import { getAccountFromId } from '@/scripts/get-account-from-id.js'; import { deckStore } from '@/ui/deck/deck-store.js'; +import { analytics, initAnalytics } from '@/analytics.js'; import { miLocalStorage } from '@/local-storage.js'; import { fetchCustomEmojis } from '@/custom-emojis.js'; import { setupRouter } from '@/router/main.js'; @@ -241,6 +242,19 @@ export async function common(createVue: () => App<Element>) { await fetchCustomEmojis(); } catch (err) { /* empty */ } + // analytics + fetchInstanceMetaPromise.then(async () => { + await initAnalytics(instance); + + if ($i) { + analytics.identify($i.id); + } + + analytics.page({ + path: window.location.pathname, + }); + }); + const app = createVue(); setupRouter(app, createMainRouter); |