feat: add umami analytics

This commit is contained in:
grassblock 2025-05-31 19:17:14 +08:00
parent e0f8e02577
commit e5d6dbda6f
2 changed files with 9 additions and 0 deletions

View file

@ -78,6 +78,13 @@ export const siteConfig = {
instanceDomain: '', instanceDomain: '',
} }
}, },
// 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
},
// neko // neko
// by enabling this, you can add a neko that follows cursor to your site // by enabling this, you can add a neko that follows cursor to your site
// this will load script from webneko.net // this will load script from webneko.net

View file

@ -18,6 +18,7 @@ interface Props {
} }
const noscript = siteConfig.noClientJavaScript const noscript = siteConfig.noClientJavaScript
const umami = siteConfig.umami
const defaultTitle = siteConfig.title const defaultTitle = siteConfig.title
const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-'); const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-');
@ -75,6 +76,7 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description =
<p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a></p> <p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a></p>
</div> </div>
</footer> </footer>
{umami.enabled && <script defer src=`https://${umami.instanceDomain}/script.js` data-website-id={umami.websiteId}></script>}
{ (siteConfig.neko.enabled && !noscript) && { (siteConfig.neko.enabled && !noscript) &&
<> <>
<script is:inline define:vars={{ nekoType }}> <script is:inline define:vars={{ nekoType }}>