mirror of
https://github.com/kremalicious/umami.git
synced 2025-01-24 01:03:39 +01:00
Fix to add basePath to trackingCode generation
This commit is contained in:
parent
586529a5ca
commit
55e91d5659
@ -4,10 +4,12 @@ import useConfig from 'hooks/useConfig';
|
||||
|
||||
export function TrackingCode({ websiteId }) {
|
||||
const { formatMessage, messages } = useMessages();
|
||||
const { trackerScriptName } = useConfig();
|
||||
const { basePath, trackerScriptName } = useConfig();
|
||||
const url = trackerScriptName?.startsWith('http')
|
||||
? trackerScriptName
|
||||
: `${location.origin}/${trackerScriptName?.split(',')?.map(n => n.trim())?.[0] || 'script.js'}`;
|
||||
: `${location.origin}${basePath}/${
|
||||
trackerScriptName?.split(',')?.map(n => n.trim())?.[0] || 'script.js'
|
||||
}`;
|
||||
|
||||
const code = `<script async src="${url}" data-website-id="${websiteId}"></script>`;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user