mirror of
https://github.com/certd/certd.git
synced 2026-05-17 22:07:34 +08:00
chore: baidutongji
This commit is contained in:
@@ -4,6 +4,11 @@ import type { Theme } from 'vitepress'
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import './style.css'
|
||||
import Layout from './Layout.vue'
|
||||
|
||||
import { registerAnalytics, siteIds, trackPageview } from './plugins/baidutongji'
|
||||
import { inBrowser } from "vitepress";
|
||||
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
Layout,
|
||||
@@ -14,5 +19,17 @@ export default {
|
||||
// },
|
||||
enhanceApp({ app, router, siteData }) {
|
||||
// ...
|
||||
if (inBrowser) {
|
||||
registerAnalytics(siteIds)
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
const { href: url } = window.location
|
||||
trackPageview(siteIds, url)
|
||||
})
|
||||
|
||||
router.onAfterRouteChanged = (to) => {
|
||||
trackPageview(siteIds, to)
|
||||
}
|
||||
}
|
||||
}
|
||||
} satisfies Theme
|
||||
|
||||
Reference in New Issue
Block a user