mirror of
https://github.com/LukeHagar/LukeHagar.com.git
synced 2025-12-06 04:20:17 +00:00
Update vitals.js
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
|
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
|
||||||
|
|
||||||
import { PUBLIC_AXIOM_INGEST_ENDPOINT } from '$env/static/public';
|
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
|
||||||
|
|
||||||
function getConnectionSpeed() {
|
function getConnectionSpeed() {
|
||||||
return 'connection' in navigator &&
|
return 'connection' in navigator &&
|
||||||
@@ -39,9 +39,9 @@ function sendToAnalytics(metric, options) {
|
|||||||
type: 'application/x-www-form-urlencoded'
|
type: 'application/x-www-form-urlencoded'
|
||||||
});
|
});
|
||||||
if (navigator.sendBeacon) {
|
if (navigator.sendBeacon) {
|
||||||
navigator.sendBeacon(PUBLIC_AXIOM_INGEST_ENDPOINT, blob);
|
navigator.sendBeacon(vitalsUrl, blob);
|
||||||
} else
|
} else
|
||||||
fetch(PUBLIC_AXIOM_INGEST_ENDPOINT, {
|
fetch(vitalsUrl, {
|
||||||
body: blob,
|
body: blob,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
|
|||||||
Reference in New Issue
Block a user