Skip to content

Commit

Permalink
修改了引入谷歌统计的方法,暂未移除依赖项
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiichen committed Dec 18, 2023
1 parent 978f1b1 commit 3173087
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,31 @@ import { getDirname, path } from '@vuepress/utils'
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
const __dirname = getDirname(import.meta.url)
export default defineUserConfig({
head: [
/*************** start 添加谷歌统计 ***********/
[
"script",
{
src: "https://www.googletagmanager.com/gtag/js?id=G-0ENBRM6T52",
async: true
}
],
[
"script",
{},
`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-0ENBRM6T52');
`
],
/*************** end 添加谷歌统计 ***********/
],
plugins: [
googleAnalyticsPlugin({
id: 'G-0ENBRM6T52',
}),
// googleAnalyticsPlugin({
// id: 'G-0ENBRM6T52',
// }),
registerComponentsPlugin({
componentsDir: path.resolve(__dirname, './components'),
}),
Expand Down

0 comments on commit 3173087

Please sign in to comment.