Merge pull request #1704 from tangly1024/feat/51la-analytics

51LA
This commit is contained in:
tangly1024
2023-12-09 18:04:59 +08:00
committed by GitHub
2 changed files with 22 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
import dynamic from 'next/dynamic'
import LA51 from './LA51'
import WebWhiz from './Webwhiz'
const TwikooCommentCounter = dynamic(() => import('@/components/TwikooCommentCounter'), { ssr: false })
@@ -97,14 +98,15 @@ const ExternalPlugin = (props) => {
<VConsole />
<LoadingProgress />
<AosAnimation />
{ANALYTICS_51LA_ID && ANALYTICS_51LA_CK && <LA51/>}
{ANALYTICS_51LA_ID && ANALYTICS_51LA_CK && (<>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js" defer/>
<script async dangerouslySetInnerHTML={{
{/* <script async dangerouslySetInnerHTML={{
__html: `
LA.init({id:"${ANALYTICS_51LA_ID}",ck:"${ANALYTICS_51LA_CK}",hashMode:true,autoTrack:true})
`
}} />
}} /> */}
</>)}
{CHATBASE_ID && (<>

18
components/LA51.js Normal file
View File

@@ -0,0 +1,18 @@
import { siteConfig } from '@/lib/config'
import { useEffect } from 'react'
/**
* 51LA统计
*/
export default function LA51() {
const ANALYTICS_51LA_ID = siteConfig('ANALYTICS_51LA_ID')
const ANALYTICS_51LA_CK = siteConfig('ANALYTICS_51LA_CK')
useEffect(() => {
const LA = window.LA
if (LA) {
LA.init({ id: `${ANALYTICS_51LA_ID}`, ck: `${ANALYTICS_51LA_CK}`, hashMode: true, autoTrack: true })
}
}, [])
return <></>
}