Fix tracking code form.

This commit is contained in:
Mike Cao 2023-04-21 17:21:44 -07:00
parent a2bce7ae2c
commit 987e3aabbd
2 changed files with 2 additions and 3 deletions

View File

@ -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 = `<script async src="${url}" data-website-id="${websiteId}"></script>`;

View File

@ -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';