mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
fix: get tracking code correctly
This commit is contained in:
parent
136f962218
commit
981abd5966
@ -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 = `<script async src="${url}" data-website-id="${websiteId}"></script>`;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user