Skip to content

Commit

Permalink
vitals
Browse files Browse the repository at this point in the history
  • Loading branch information
icco committed Dec 2, 2024
1 parent ac8fb52 commit 818d1ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/tachyons.min.css" />
<link href="css/other-5fd3fb7b.css" rel="stylesheet">
<link href="css/print-c28e2d83.css" rel="stylesheet" media="print">
<script type="module">
import { onCLS, onINP, onLCP, onFCP, onFID, onTTFB } from 'https://unpkg.com/web-vitals@4?module';

function sendToAnalytics(metric) {
const body = JSON.stringify(metric);
(navigator.sendBeacon && navigator.sendBeacon('https://reportd.natwelch.com/analytics/resume', body)) ||
fetch('https://reportd.natwelch.com/analytics/resume', { body, method: 'POST', keepalive: true });
}

onCLS(sendToAnalytics);
onFCP(sendToAnalytics);
onFID(sendToAnalytics);
onINP(sendToAnalytics);
onLCP(sendToAnalytics);
onTTFB(sendToAnalytics);
</script>
</head>

<body class="index black mw7 mw-100-print avenir lh-copy">
Expand Down

0 comments on commit 818d1ae

Please sign in to comment.