Show custom tracker script name.

This commit is contained in:
Mike Cao 2022-08-08 11:50:27 -07:00
parent 9b7e472410
commit 8aa9941ca7

View File

@ -4,10 +4,12 @@ import { useRouter } from 'next/router';
import Button from 'components/common/Button';
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
import CopyButton from 'components/common/CopyButton';
import useConfig from 'hooks/useConfig';
export default function TrackingCodeForm({ values, onClose }) {
const ref = useRef();
const { basePath } = useRouter();
const { trackerScriptName } = useConfig();
return (
<FormLayout>
@ -24,7 +26,9 @@ export default function TrackingCodeForm({ values, onClose }) {
rows={3}
cols={60}
spellCheck={false}
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}${basePath}/umami.js"></script>`}
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${
document.location.origin
}${basePath}/${trackerScriptName ? `${trackerScriptName}.js` : 'umami.js'}"></script>`}
readOnly
/>
</FormRow>