Support more analytic tools

This commit is contained in:
Korbs 2024-06-10 21:38:01 -04:00
parent 5040cca114
commit 0bd86b9bcd

View file

@ -8,7 +8,15 @@ import {
PLAUSIBLE_SRC, PLAUSIBLE_SRC,
UMAMI_ID, UMAMI_ID,
UMAMI_SRC, UMAMI_SRC,
AMPLITUDE_APIKEY AMPLITUDE_APIKEY,
METRICAL_APP,
FATHOM_SITE,
FATHOM_SRC,
MINIAML_ID,
SWETRIX_SRC,
SWETRIX_API,
SWETRIX_PROJECT_ID,
SIMPLEANALYTICS_DOMAIN
} from '@utils/GetConfig' } from '@utils/GetConfig'
// Get Astro Analytics // Get Astro Analytics
@ -21,7 +29,7 @@ import {
Amplitude, Amplitude,
Matomo, Matomo,
MinimalAnalytics MinimalAnalytics
} from 'astro-analytics'; } from 'astro-analytics'
--- ---
<!-- https://gist.sudovanilla.org/Korbs/fac0f5b99a6e43679c1d38d614721b5e --> <!-- https://gist.sudovanilla.org/Korbs/fac0f5b99a6e43679c1d38d614721b5e -->
@ -37,6 +45,24 @@ import {
<Amplitude apiKey={AMPLITUDE_APIKEY} /> <Amplitude apiKey={AMPLITUDE_APIKEY} />
} else if (ANALYTICS === "Matomo") { } else if (ANALYTICS === "Matomo") {
<Matomo id={MATOMO_ID} src={MATOMO_SRC} /> <Matomo id={MATOMO_ID} src={MATOMO_SRC} />
} else if (ANALYTICS === "Metrical") {
<Metrical app={METRICAL_APP} />
} else if (ANALYTICS === "Fathom") {
<Fathom site={FATHOM_SITE} src={FATHOM_SRC} />
} else if (ANALYTICS === "MinimalAnalytics") {
<MinimalAnalytics id={MINIAML_ID} />
} else if (ANALYTICS === "Swetrix") {
<script is:inline src={SWETRIX_SRC} defer></script>
<script is:inline>
document.addEventListener('DOMContentLoaded', function () {
swetrix.init({SWETRIX_PROJECT_ID})
swetrix.trackViews()
})
</script>
<noscript><img src={SWETRIX_API + '/log/noscript?pid=' + SWETRIX_PROJECT_ID} alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>
} else if (ANALYTICS === "Simple Analytics") {
<script is:inline async defer data-hostname={SIMPLEANALYTICS_DOMAIN} src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
<noscript><img src={'https://queue.simpleanalyticscdn.com/noscript.gif?hostname=' + SIMPLEANALYTICS_DOMAIN} alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>
} }
} }
} }