Skip to content

Commit

Permalink
51LA
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Dec 9, 2023
1 parent 9764769 commit 299cce7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/ExternalPlugins.js
Original file line number Diff line number Diff line change
@@ -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 })
Expand Down Expand Up @@ -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 && (<>
Expand Down
18 changes: 18 additions & 0 deletions components/LA51.js
Original file line number Diff line number Diff line change
@@ -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 <></>
}

0 comments on commit 299cce7

Please sign in to comment.