google-analytics plugin for vitepress
npm install vitepress-plugin-google-analytics> Google analytics plugin for Vitepress
sh
yarn add -D vitepress-plugin-google-analytics
OR npm install -D vitepress-plugin-google-analytics
`Usage
`ts
// .vitepress/theme/index.tsimport DefaultTheme from "vitepress/theme"
import googleAnalytics from 'vitepress-plugin-google-analytics'
export default {
...DefaultTheme,
enhanceApp: (ctx) => {
googleAnalytics({
id: 'G-', // Replace with your GoogleAnalytics ID, which should start with the 'G-'
})
}
}
`Then you can use
Google analytics in production`! 🎉