Open blox814123 opened 2 years ago
Could you use events for that? Maybe add
<script>
window.mod_pagespeed_start = Number(new Date());
</script>
at the top of the head section. Then add:
<script>
function g(){
let payload = 'load:'+ (Number(new Date())-window.mod_pagespeed_start);
window.goatcounter.count({
path: function(p) { return 'load-time-' + p },
title: payload,
event: true,
});
};
let f = window.addEventListener;
if (f) {
f('load',g,false);
} else {
f=window.attachEvent;
if (f) {
f('onload',g);
}
};
</script>
at the bottom of the page before the /body tag.
I am not precisely sure how to pull event data, you might need to use SQL to handle it.
Note that goatcounter's count.js script can't do it. Usually, it's loaded async so won't be able to run first thing during the page load to record start time or be able to run at the end of the page. The earliest it will run will be after it loads sometime after the page is displayed.
You may need to defer the window.goatcounter call as described at https://www.goatcounter.com/help/js#methods-44.
In contrast to other self-hosted analytics like Shynet and plausible, goatcounter doesn't measure page load time. This seems to be a basic feature necessary for troubleshooting and measuring performance. Would be aprecciated if you added it.