From 981abd5966c9f54e373d4ab00cae17b204552141 Mon Sep 17 00:00:00 2001 From: MBRjun Date: Thu, 20 Apr 2023 22:41:25 +0800 Subject: [PATCH] fix: get tracking code correctly --- components/pages/settings/websites/TrackingCode.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/pages/settings/websites/TrackingCode.js b/components/pages/settings/websites/TrackingCode.js index 4f692d21..83bfe87c 100644 --- a/components/pages/settings/websites/TrackingCode.js +++ b/components/pages/settings/websites/TrackingCode.js @@ -1,12 +1,13 @@ import { TextArea } from 'react-basics'; -import { TRACKER_SCRIPT_URL } from 'lib/constants'; import useMessages from 'hooks/useMessages'; +import useConfig from 'hooks/useConfig'; export default function TrackingCode({ websiteId }) { const { formatMessage, messages } = useMessages(); - const url = TRACKER_SCRIPT_URL.startsWith('http') - ? TRACKER_SCRIPT_URL - : `${location.origin}${TRACKER_SCRIPT_URL}`; + const { trackerScriptName } = useConfig(); + const url = trackerScriptName.startsWith('http') + ? trackerScriptName + : `${location.origin}/${trackerScriptName}.js`; const code = ``;