diff --git a/blog.config.js b/blog.config.js index 50e16921..8f35f94d 100644 --- a/blog.config.js +++ b/blog.config.js @@ -352,6 +352,9 @@ const BLOG = { SEO_BAIDU_SITE_VERIFICATION: process.env.NEXT_PUBLIC_SEO_BAIDU_SITE_VERIFICATION || '', // Remove the value or replace it with your own google site verification code + // 微软 Clarity 站点分析 + CLARITY_ID: process.env.NEXT_PUBLIC_CLARITY_ID || null , // 只需要复制Clarity脚本中的ID部分,ID是一个十位的英文数字组合 + // <---- 站点统计 // START---->营收相关 diff --git a/components/Busuanzi.js b/components/Busuanzi.js index fec41e5f..cbeb54da 100644 --- a/components/Busuanzi.js +++ b/components/Busuanzi.js @@ -2,14 +2,14 @@ import busuanzi from '@/lib/busuanzi' import { useRouter } from 'next/router' import { useGlobal } from '@/lib/global' // import { useRouter } from 'next/router' -import React from 'react' +import { useEffect } from 'react' let path = '' export default function Busuanzi () { const { theme } = useGlobal() - const Router = useRouter() - Router.events.on('routeChangeComplete', (url, option) => { + const router = useRouter() + router.events.on('routeChangeComplete', (url, option) => { if (url !== path) { path = url busuanzi.fetch() @@ -17,7 +17,7 @@ export default function Busuanzi () { }) // 更换主题时更新 - React.useEffect(() => { + useEffect(() => { if (theme) { busuanzi.fetch() } diff --git a/components/ExternalPlugins.js b/components/ExternalPlugins.js index 77433f97..b426ee65 100644 --- a/components/ExternalPlugins.js +++ b/components/ExternalPlugins.js @@ -78,6 +78,7 @@ const ExternalPlugin = (props) => { const DIFY_CHATBOT_ENABLED = siteConfig('DIFY_CHATBOT_ENABLED') const TIANLI_KEY = siteConfig('TianliGPT_KEY') const GLOBAL_JS = siteConfig('GLOBAL_JS') + const CLARITY_ID = siteConfig('CLARITY_ID') // 自定义样式css和js引入 if (isBrowser) { @@ -167,6 +168,19 @@ const ExternalPlugin = (props) => { }} /> )} + + {CLARITY_ID && (<> +