From 4b7564e0183f864114f4af5d60adbb94589593d6 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 1 Aug 2023 15:58:31 +0800 Subject: [PATCH] =?UTF-8?q?Ackee=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Ackee.js | 27 +++++++++++++++++++++++---- components/CommonScript.js | 4 ++-- lib/utils.js | 4 ++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/components/Ackee.js b/components/Ackee.js index 63b47037..dd9467f0 100644 --- a/components/Ackee.js +++ b/components/Ackee.js @@ -4,10 +4,11 @@ import { useEffect } from 'react' import BLOG from '@/blog.config' import { loadExternalResource } from '@/lib/utils' import { useRouter } from 'next/router' - const Ackee = () => { const router = useRouter() - useEffect(() => { + + // handleAckee 函数 + const handleAckeeCallback = () => { handleAckee( router.asPath, { @@ -15,10 +16,28 @@ const Ackee = () => { domainId: BLOG.ANALYTICS_ACKEE_DOMAIN_ID }, { - detailed: false, - ignoreLocalhost: false + /* + * Enable or disable tracking of personal data. + * We recommend to ask the user for permission before turning this option on. + */ + detailed: true, + /* + * Enable or disable tracking when on localhost. + */ + ignoreLocalhost: false, + /* + * Enable or disable the tracking of your own visits. + * This is enabled by default, but should be turned off when using a wildcard Access-Control-Allow-Origin header. + * Some browsers strictly block third-party cookies. The option won't have an impact when this is the case. + */ + ignoreOwnVisits: false } ) + } + + // 或者使用其他依赖数组,根据需要执行 handleAckee + useEffect(() => { + handleAckeeCallback() }, [router]) return null diff --git a/components/CommonScript.js b/components/CommonScript.js index 6912c3cc..4bef4da0 100644 --- a/components/CommonScript.js +++ b/components/CommonScript.js @@ -56,12 +56,12 @@ const CommonScript = () => { {/* 代码统计 */} {/* ackee统计脚本 */} - {BLOG.ANALYTICS_ACKEE_TRACKER && ( + {/* {BLOG.ANALYTICS_ACKEE_TRACKER && (