Skip to content

Commit

Permalink
docs: 添加googleAnalytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Jun 6, 2024
1 parent c89a416 commit b04c161
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 7 additions & 4 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import {h} from 'vue'
import type {Theme} from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import googleAnalytics from 'vitepress-plugin-google-analytics'
import './style.css'

export default {
Expand All @@ -11,7 +12,9 @@ export default {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
})
},
enhanceApp({ app, router, siteData }) {
// ...
enhanceApp({app, router, siteData}) {
googleAnalytics({
id: 'G-BLBVX50DXQ'
})
}
} satisfies Theme
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"devDependencies": {
"vitepress": "^1.2.2"
"vitepress": "^1.2.2",
"vitepress-plugin-google-analytics": "^1.0.2"
},
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
}
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,11 @@ vite@^5.2.11:
optionalDependencies:
fsevents "~2.3.3"

vitepress-plugin-google-analytics@^1.0.2:
version "1.0.2"
resolved "https://registry.npmmirror.com/vitepress-plugin-google-analytics/-/vitepress-plugin-google-analytics-1.0.2.tgz#e037d3723284a896560fe7371c223c1f737ae13c"
integrity sha512-ri8bFUAmt3c/DtPrALauGBIUr2gIJ11c1qNRhwd3/+aiuYZBfQpOosSxcO1AswgwRxP9FwBS6Z7jgdDVyXb2hA==

vitepress@^1.2.2:
version "1.2.2"
resolved "https://registry.npmmirror.com/vitepress/-/vitepress-1.2.2.tgz#7680c807ab62ece6edd1cd1ec41f8619860e9ba2"
Expand Down

0 comments on commit b04c161

Please sign in to comment.