Created
January 13, 2014 20:23
-
-
Save deckerweb/8407394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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