refactor: use @vercel/speed-insights for web vitals

This commit is contained in:
Bart van der Braak 2024-01-16 03:50:32 +01:00
parent 09fc87af81
commit 8e37873b65
4 changed files with 12 additions and 123 deletions

View file

@ -4,24 +4,8 @@
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
});
}
import { injectSpeedInsights } from '@vercel/speed-insights/sveltekit';
injectSpeedInsights();
export let data;
</script>