Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix knip

Blue Mouse84ef18ae8921
diff --git a/web/app/modals/TrackingSnippet.tsx b/web/app/modals/TrackingSnippet.tsx
deleted file mode 100644
index e57c5bd52..000000000
--- a/web/app/modals/TrackingSnippet.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { useTranslation, Trans } from 'react-i18next'
-
-import { API_URL, isSelfhosted } from '~/lib/constants'
-import { useCurrentProject } from '~/providers/CurrentProjectProvider'
-import { Badge } from '~/ui/Badge'
-import Modal from '~/ui/Modal'
-import Textarea from '~/ui/Textarea'
-
-const API_URL_WITHOUT_TRAILING_SLASH = API_URL.endsWith('/')
- ? API_URL.slice(0, -1)
- : API_URL
-
-interface TrackingSnippetProps {
- onClose: () => void
- isOpened: boolean
-}
-
-export const getSnippet = (pid: string) => {
- if (isSelfhosted) {
- return `<script src="https://swetrix.org/swetrix.js" defer></script>
-<script>
- document.addEventListener('DOMContentLoaded', function() {
- swetrix.init('${pid}', {
- apiURL: '${API_URL_WITHOUT_TRAILING_SLASH}/v1/log',
- })
- swetrix.trackViews()
- })
-</script>
-
-<noscript>
- <img
- src="${API_URL_WITHOUT_TRAILING_SLASH}/log/noscript?pid=${pid}"
- alt=""
- referrerpolicy="no-referrer-when-downgrade"
- />
-</noscript>`
- }
-
- return `<script src="https://swetrix.org/swetrix.js" defer></script>
-<script>
- document.addEventListener('DOMContentLoaded', function() {
- swetrix.init('${pid}')
- swetrix.trackViews()
- })
-</script>
-
-<noscript>
- <img
- src="https://api.swetrix.com/log/noscript?pid=${pid}"
- alt=""
- referrerpolicy="no-referrer-when-downgrade"
- />
-</noscript>`
-}
-
-const SCRIPT_DOCS_URL = 'https://swetrix.com/docs/install-script'
-
-const TrackingSnippet = ({ onClose, isOpened }: TrackingSnippetProps) => {
- const { id } = useCurrentProject()
- const { t } = useTranslation('common')
-
- const snippet = getSnippet(id)
-
- return (
- <Modal
- onClose={onClose}
- message={
- <div>
- <p>
- <Trans
- t={t}
- i18nKey='modals.trackingSnippet.add'
- components={{
- bsect: <Badge label='<body>' colour='slate' />,
- }}
- />
- </p>
- <Textarea
- classes={{
- container: 'mt-2 font-mono',
- }}
- value={snippet}
- rows={17}
- readOnly
- />
- <p className='mt-4'>
- <Trans
- t={t}
- i18nKey='modals.trackingSnippet.docs'
- components={{
- pdocs: (
- <a
- href={SCRIPT_DOCS_URL}
- className='font-medium underline decoration-dashed hover:decoration-solid'
- target='_blank'
- rel='noreferrer noopener'
- />
- ),
- }}
- />
- </p>
- </div>
- }
- title={t('modals.trackingSnippet.title')}
- isOpened={isOpened}
- />
- )
-}
-
-export default TrackingSnippet
diff --git a/web/public/locales/de.json b/web/public/locales/de.json
index 0b6ace51e..f64f6d75c 100644
--- a/web/public/locales/de.json
+++ b/web/public/locales/de.json
@@ -2065,9 +2065,7 @@
"desc": "Wir entschuldigen uns für die Unannehmlichkeiten, aber Sie müssen ein kostenpflichtiges Abo abschließen, um diese Funktion nutzen zu können.\n\nWir wissen, dass Sie vielleicht noch nicht bereit sind, ein kostenpflichtiges Abonnement abzuschließen, aber wenn Sie ein Abonnement abschließen, haben Sie nicht nur Zugang zu dieser Funktion, sondern auch zu allen anderen kostenpflichtigen Funktionen, höhere Limits für die monatlichen Besuchszahlen und die Anzahl der zur Verfügung stehenden Websites. Außerdem unterstützen Sie das Wachstum eines kleinen Unternehmens :)"
},
"trackingSnippet": {
- "title": "Fügen Sie Ihrer Website einen Swetrix-Tracking-Code hinzu",
- "add": "Fügen Sie folgendes Snippet in den <bsect></bsect> Bereich Ihrer Website ein.",
- "docs": "Lesen Sie unsere <pdocs>Dokumentation</pdocs> für Details und weitere Integrationsanleitungen."
+ "add": "Fügen Sie folgendes Snippet in den <bsect></bsect> Bereich Ihrer Website ein."
},
"funnels": {
"addTitle": "Trichter hinzufügen",
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 3737ba054..f2ca4eb2f 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -2065,9 +2065,7 @@
"desc": "We apologise for the inconvenience, but you must subscribe to a paid plan to use this feature.\n\nWe realise that you might not be ready to buy a paid subscription yet, but buying it will give you not only access to this feature, but also many other great perks, such as access to all the other paid features, higher limits on visits per month and number of websites available, and you will support the growth of a small business :)"
},
"trackingSnippet": {
- "title": "Add a Swetrix tracking code to your website",
- "add": "Add the following snippet into the <bsect></bsect> section of your site.",
- "docs": "Check our <pdocs>our documentation</pdocs> for details and more integration guides."
+ "add": "Add the following snippet into the <bsect></bsect> section of your site."
},
"funnels": {
"addTitle": "Add funnel",
diff --git a/web/public/locales/fr.json b/web/public/locales/fr.json
index b3d9a374e..c41d4c8f1 100644
--- a/web/public/locales/fr.json
+++ b/web/public/locales/fr.json
@@ -2065,9 +2065,7 @@
"desc": "Nous nous excusons pour le désagrément, mais vous devez souscrire à un plan payant pour utiliser cette fonctionnalité.\n\nNous réalisons que vous n'êtes peut-être pas encore prêt à acheter un abonnement payant, mais l'acheter vous donnera non seulement accès à cette fonctionnalité, mais aussi à de nombreux autres avantages, tels que l'accès à toutes les autres fonctionnalités payantes, des limites plus élevées sur les visites par mois et le nombre de sites web disponibles, et vous soutiendrez la croissance d'une petite entreprise :)"
},
"trackingSnippet": {
- "title": "Ajoutez un code de suivi Swetrix à votre site web",
- "add": "Ajoutez l'extrait de code suivant dans la section <bsect></bsect> de votre site.",
- "docs": "Consultez notre <pdocs>documentation</pdocs> pour plus de détails et d'autres guides d'intégration."
+ "add": "Ajoutez l'extrait de code suivant dans la section <bsect></bsect> de votre site."
},
"funnels": {
"addTitle": "Ajouter un entonnoir",
diff --git a/web/public/locales/pl.json b/web/public/locales/pl.json
index 5da1e6365..ce2a08aa4 100644
--- a/web/public/locales/pl.json
+++ b/web/public/locales/pl.json
@@ -2065,9 +2065,7 @@
"desc": "Przepraszamy za niedogodności, ale aby korzystać z tej funkcji, musisz wykupić płatny plan.\n\nZdajemy sobie sprawę, że możesz nie być jeszcze gotowy na zakup płatnej subskrypcji, ale jej zakup da Ci nie tylko dostęp do tej funkcji, ale także wiele innych wspaniałych korzyści, takich jak dostęp do wszystkich innych płatnych funkcji, wyższe limity wizyt w miesiącu i liczba dostępnych stron internetowych, a także będziesz wspierać rozwój małego biznesu :)"
},
"trackingSnippet": {
- "title": "Dodaj kod śledzenia Swetrix do swojej strony internetowej",
- "add": "Dodaj następujący fragment do sekcji <bsect></bsect> twojej strony.",
- "docs": "Sprawdź naszą <pdocs>dokumentację</pdocs>, aby poznać szczegóły i więcej przewodników integracyjnych."
+ "add": "Dodaj następujący fragment do sekcji <bsect></bsect> twojej strony."
},
"funnels": {
"addTitle": "Dodaj lejek",
diff --git a/web/public/locales/uk.json b/web/public/locales/uk.json
index 0c39ec94d..67002edab 100644
--- a/web/public/locales/uk.json
+++ b/web/public/locales/uk.json
@@ -2065,9 +2065,7 @@
"desc": "Ми вибачаємося за незручності, але ви повинні підписатися на платний план, щоб використовувати цю функцію.\n\nМи розуміємо, що ви можете бути ще не готові купити платну підписку, але, купуючи її, ви отримаєте не тільки доступ до цього функціоналу, а й багато інших бонусів, наприклад, доступ до всіх інших платних функцій, вищі обмеження за відвідуваннями на місяць і кількістю доступних вебсайтів, а також підтримаєте зростання малого бізнесу :)"
},
"trackingSnippet": {
- "title": "Додайте код відстеження Swetrix на свій сайт",
- "add": "Додайте наступний фрагмент до розділу <bsect></bsect> вашого сайту.",
- "docs": "Перегляньте нашу <pdocs>документацію</pdocs> для отримання детальної інформації та інших посібників з інтеграції."
+ "add": "Додайте наступний фрагмент до розділу <bsect></bsect> вашого сайту."
},
"funnels": {
"addTitle": "Додати воронку",