From 987e3aabbd1cac09997e723eb3610ee18221afa3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 21 Apr 2023 17:21:44 -0700 Subject: [PATCH] Fix tracking code form. --- components/pages/settings/websites/TrackingCode.js | 4 ++-- lib/constants.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/pages/settings/websites/TrackingCode.js b/components/pages/settings/websites/TrackingCode.js index fc2e5e68..425dda06 100644 --- a/components/pages/settings/websites/TrackingCode.js +++ b/components/pages/settings/websites/TrackingCode.js @@ -5,9 +5,9 @@ import useConfig from 'hooks/useConfig'; export function TrackingCode({ websiteId }) { const { formatMessage, messages } = useMessages(); const { trackerScriptName } = useConfig(); - const url = trackerScriptName.startsWith('http') + const url = trackerScriptName?.startsWith('http') ? trackerScriptName - : `${location.origin}/${trackerScriptName?.split(',')?.map(n => n.trim())?.[0]}`; + : `${location.origin}/${trackerScriptName?.split(',')?.map(n => n.trim())?.[0] || 'script.js'}`; const code = ``; diff --git a/lib/constants.ts b/lib/constants.ts index 9b16fc55..425d729f 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -12,7 +12,6 @@ export const HOMEPAGE_URL = 'https://umami.is'; export const REPO_URL = 'https://github.com/umami-software/umami'; export const UPDATES_URL = 'https://api.umami.is/v1/updates'; export const TELEMETRY_PIXEL = 'https://i.umami.is/a.png'; -export const TRACKER_SCRIPT_URL = '/script.js'; export const DEFAULT_LOCALE = 'en-US'; export const DEFAULT_THEME = 'light';