feat: implement @vercel/analytics and web-vitals dependencies

This commit is contained in:
Bart van der Braak 2024-01-16 03:33:31 +01:00
parent 7d70f2d2ed
commit 2f6387df2c
4 changed files with 122 additions and 1 deletions

View file

@ -4,6 +4,23 @@
import '../styles/globals.css';
import { ModeWatcher } from 'mode-watcher';
import { fly } from 'svelte/transition';
import { inject } from '@vercel/analytics';
import { webVitals } from '$lib/vitals';
import { browser } from '$app/environment';
import { page } from '$app/stores';
inject({ mode: dev ? 'development' : 'production' });
let analyticsId = import.meta.env.VERCEL_ANALYTICS_ID;
$: if (browser && analyticsId) {
webVitals({
path: $page.url.pathname,
params: $page.params,
analyticsId,
debug: false
});
}
export let data;
</script>