Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Created January 13, 2014 20:23
Show Gist options
  • Select an option

  • Save deckerweb/8407394 to your computer and use it in GitHub Desktop.

Select an option

Save deckerweb/8407394 to your computer and use it in GitHub Desktop.
<?php
function response_time() {
echo "<script>
window.addEventListener(
'load',
function() {
setTimeout(
function() {
if ( window.performance && window.performance.timing && window.console ) {
var timing = window.performance.timing;
console.log(
'Response time: %d ms',
parseInt(timing.responseEnd - timing.fetchStart)
);
}
},
0
);
},
false
);
</script>";
}
add_action(
'wp_footer',
'response_time'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment