diff --git a/src/config.ts b/src/config.ts index 2103172..5f41684 100644 --- a/src/config.ts +++ b/src/config.ts @@ -85,10 +85,17 @@ export const siteConfig = { }, // umami analytics // by enabling this, you can track the visitors of your site - umami: { - enabled: false, // enable umami analytics - instanceDomain: 'cloud.umami.is', // the url of the umami script, usually your-umami-instance.com (default: official cloud.umami.is) - websiteId: 'your-website-id', // the id of your website in umami, get it from your umami dashboard + siteAnalytics: { + enabled: false, // enable analytics + type: 'umami', // 'umami', 'goatcounter' + umami: { + instanceDomain: 'cloud.umami.is', // the domain of the umami instance, usually your-umami-instance.com (default: official cloud.umami.is) + websiteId: 'your-website-id', // the id of your website in umami, get it from your umami dashboard + }, + goatcounter: { + // provide solutions for tracking visitors without Javascript + instanceDomain: 'yourcodehere.goatcounter.com', // the domain of the goatcounter instance, usually your-goatcounter-instance.com + }, }, // neko // by enabling this, you can add a neko that follows cursor to your site diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 365b6af..d7ccb74 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -18,7 +18,11 @@ interface Props { } const noscript = siteConfig.noClientJavaScript -const umami = siteConfig.umami + +const statisticsEnabled = siteConfig.siteAnalytics.enabled +const statisticsType = siteConfig.siteAnalytics.type +const umamiConfig = siteConfig.siteAnalytics.umami +const goatCounterConfig = siteConfig.siteAnalytics.goatcounter const defaultTitle = siteConfig.title const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-'); @@ -68,6 +72,7 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description = - {umami.enabled && } + {statisticsEnabled && statisticsType === 'umami' && ( + + )} + {statisticsEnabled && statisticsType === 'goatcounter' && ( + <> + {noscript ? ( + Analytics + ) : ( + <> + + + + )} + + )} { (siteConfig.neko.enabled && !noscript) && <> -