2022-08-08 20:50:27 +02:00
|
|
|
import useConfig from 'hooks/useConfig';
|
2022-12-27 01:57:59 +01:00
|
|
|
import { useRef } from 'react';
|
|
|
|
import { Form, FormRow, TextArea } from 'react-basics';
|
2020-08-08 05:36:57 +02:00
|
|
|
|
2022-12-27 01:57:59 +01:00
|
|
|
export default function TrackingCodeForm({ websiteId }) {
|
|
|
|
const ref = useRef(null);
|
2022-08-08 20:50:27 +02:00
|
|
|
const { trackerScriptName } = useConfig();
|
2022-12-27 01:57:59 +01:00
|
|
|
const code = `<script async defer src="${trackerScriptName}" data-website-id="${websiteId}"></script>`;
|
2020-08-08 05:36:57 +02:00
|
|
|
|
|
|
|
return (
|
2022-12-27 01:57:59 +01:00
|
|
|
<>
|
|
|
|
<Form ref={ref}>
|
|
|
|
<FormRow>
|
|
|
|
<p>
|
|
|
|
To track stats for this website, place the following code in the{' '}
|
|
|
|
<code><head></code> section of your HTML.
|
|
|
|
</p>
|
|
|
|
<TextArea rows={4} value={code} readOnly allowCopy />
|
|
|
|
</FormRow>
|
|
|
|
</Form>
|
|
|
|
</>
|
2020-08-08 05:36:57 +02:00
|
|
|
);
|
|
|
|
}
|