mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 02:06:19 +01:00
Merge pull request #2047 from jclab-joseph/fix/tracking-code-base-path
Fix to add basePath to trackingCode generation
This commit is contained in:
commit
050cd2f5d9
@ -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