Skip to content

Commit 4d89195

Browse files
committed
Track TTLB
1 parent 0a21917 commit 4d89195

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@
102102
//# sourceURL=sw.inline.js
103103
</script>
104104

105-
<script src=/js/obs.speedcurve.js?v=0001 type=module></script>
105+
<script src=/js/obs.speedcurve.js?v=0002 type=module></script>

js/obs.speedcurve.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,13 @@
6464
LUX.addData('fromPrerender', false);
6565
}
6666

67+
// Time to Last Byte (TTLB)
68+
if (navigation.responseEnd && navigation.startTime >= 0) {
69+
const ttlb = Math.round(navigation.responseEnd - navigation.startTime);
70+
if (Number.isFinite(ttlb) && ttlb >= 0) {
71+
LUX.addData('TTLB', ttlb);
72+
}
73+
}
74+
75+
6776
})();

0 commit comments

Comments
 (0)