Support more analytic tools
This commit is contained in:
parent
5040cca114
commit
0bd86b9bcd
1 changed files with 41 additions and 15 deletions
|
@ -8,7 +8,15 @@ import {
|
|||
PLAUSIBLE_SRC,
|
||||
UMAMI_ID,
|
||||
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'
|
||||
|
||||
// Get Astro Analytics
|
||||
|
@ -21,22 +29,40 @@ import {
|
|||
Amplitude,
|
||||
Matomo,
|
||||
MinimalAnalytics
|
||||
} from 'astro-analytics';
|
||||
} from 'astro-analytics'
|
||||
---
|
||||
|
||||
<!-- https://gist.sudovanilla.org/Korbs/fac0f5b99a6e43679c1d38d614721b5e -->
|
||||
{
|
||||
()=> {
|
||||
if (ANALYTICS === "None") {
|
||||
return null
|
||||
} else if (ANALYTICS === "Plausible") {
|
||||
<Plausible domain={PLAUSIBLE_DOMAIN} src={PLAUSIBLE_SRC + "/yoursript.js"} />
|
||||
} else if (ANALYTICS === "Umami") {
|
||||
<Umami id="4fb7fa4c-5b46-438d-94b3-3a8fb9bc2e8b" src={UMAMI_SRC + "/umami.js"} />
|
||||
} else if (ANALYTICS === "Amplitude") {
|
||||
<Amplitude apiKey={AMPLITUDE_APIKEY} />
|
||||
} else if (ANALYTICS === "Matomo") {
|
||||
<Matomo id={MATOMO_ID} src={MATOMO_SRC} />
|
||||
}
|
||||
()=> {
|
||||
if (ANALYTICS === "None") {
|
||||
return null
|
||||
} else if (ANALYTICS === "Plausible") {
|
||||
<Plausible domain={PLAUSIBLE_DOMAIN} src={PLAUSIBLE_SRC + "/yoursript.js"} />
|
||||
} else if (ANALYTICS === "Umami") {
|
||||
<Umami id="4fb7fa4c-5b46-438d-94b3-3a8fb9bc2e8b" src={UMAMI_SRC + "/umami.js"} />
|
||||
} else if (ANALYTICS === "Amplitude") {
|
||||
<Amplitude apiKey={AMPLITUDE_APIKEY} />
|
||||
} else if (ANALYTICS === "Matomo") {
|
||||
<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>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue