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/router/main.ts | |
| parent | chore(config): migrate renovate config (#15550) (diff) | |
| download | misskey-2b6638e1607e5c44eb6f6dc987e9e893927f1829.tar.gz misskey-2b6638e1607e5c44eb6f6dc987e9e893927f1829.tar.bz2 misskey-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/router/main.ts')
| -rw-r--r-- | packages/frontend/src/router/main.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/frontend/src/router/main.ts b/packages/frontend/src/router/main.ts index 4379b6a316..3932a8bac8 100644 --- a/packages/frontend/src/router/main.ts +++ b/packages/frontend/src/router/main.ts @@ -7,6 +7,7 @@ import { EventEmitter } from 'eventemitter3'; import type { IRouter, Resolved, RouteDef, RouterEvent, RouterFlag } from '@/nirax.js'; import type { App, ShallowRef } from 'vue'; +import { analytics } from '@/analytics.js'; /** * {@link Router}による画面遷移を可能とするために{@link mainRouter}をセットアップする。 @@ -29,6 +30,14 @@ export function setupRouter(app: App, routerFactory: ((path: string) => IRouter) window.history.replaceState({ key: ctx.key }, '', ctx.path); }); + mainRouter.addListener('change', ctx => { + console.log('mainRouter: change', ctx.path); + analytics.page({ + path: ctx.path, + title: ctx.path, + }); + }); + mainRouter.init(); setMainRouter(mainRouter); |