mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 07:26:49 +00:00
支持微软clarity
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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 && (<>
|
||||
<script async dangerouslySetInnerHTML={{
|
||||
__html:`
|
||||
(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||
})(window, document, "clarity", "script", "${CLARITY_ID}");
|
||||
`
|
||||
}}/>
|
||||
</>)}
|
||||
|
||||
{COMMENT_DAO_VOICE_ID && (<>
|
||||
{/* DaoVoice 反馈 */}
|
||||
<script async dangerouslySetInnerHTML={{
|
||||
|
||||
Reference in New Issue
Block a user