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>
This commit is contained in:
syuilo 2025-02-25 20:51:23 +09:00 committed by GitHub
parent 20cc6d3049
commit 2b6638e160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 327 additions and 16 deletions

View file

@ -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);