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 { TextArea } from 'react-basics';
|
||||||
import { TRACKER_SCRIPT_URL } from 'lib/constants';
|
|
||||||
import useMessages from 'hooks/useMessages';
|
import useMessages from 'hooks/useMessages';
|
||||||
|
import useConfig from 'hooks/useConfig';
|
||||||
|
|
||||||
export default function TrackingCode({ websiteId }) {
|
export default function TrackingCode({ websiteId }) {
|
||||||
const { formatMessage, messages } = useMessages();
|
const { formatMessage, messages } = useMessages();
|
||||||
const url = TRACKER_SCRIPT_URL.startsWith('http')
|
const { trackerScriptName } = useConfig();
|
||||||
? TRACKER_SCRIPT_URL
|
const url = trackerScriptName.startsWith('http')
|
||||||
: `${location.origin}${TRACKER_SCRIPT_URL}`;
|
? trackerScriptName
|
||||||
|
: `${location.origin}/${trackerScriptName}.js`;
|
||||||
|
|
||||||
const code = `<script async src="${url}" data-website-id="${websiteId}"></script>`;
|
const code = `<script async src="${url}" data-website-id="${websiteId}"></script>`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user