Skip to content

Commit 4062536

Browse files
committed
Send HTTP protocol information to SpeedCurve
1 parent 7ae3eba commit 4062536

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

js/obs.speedcurve.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,19 @@
3434
window.LUX.addData(key, obs[key]);
3535
}
3636
}
37+
38+
// Send HTTP Protocol if available via Server-Timing header.
39+
const navEntry = performance.getEntriesByType('navigation')[0];
40+
if (!navEntry || !Array.isArray(navEntry.serverTiming)) {
41+
return;
42+
}
43+
44+
const protocol = navEntry.serverTiming.find(t => t.name === 'protocol');
45+
46+
if (!protocol || !protocol.description) {
47+
return;
48+
}
49+
50+
LUX.addData('Protocol', protocol.description);
51+
3752
})();

0 commit comments

Comments
 (0)