#googleanalytics
function logTimes(message) {
if (window.performance) {
performance.mark(message); // this one is for WebPageTest
console.timeStamp(message); // this is for the Performance tab in Chrome DevTools
console.info(message, performance.now()); // this is for the console, duh
// this here is for Google Analytics
ga('send', {
hitType: 'timing',
timingCategory: 'Performance',
timingVar: message,
timingValue: Math.round(performance.now())
});
}
}
// use it like so
bindAllMyEventsOrWhateverGetsThePageReady();
logTimes('The page is really ready');