Created
December 13, 2010 15:27
-
-
Save jsr/739095 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
var _gaq = _gaq || []; | |
(function() { | |
var headTime = new Date().getTime(); | |
var reportTimeSegment = function(index, name, start, end, scope) { | |
if( (start && end) && (end-start > 0) ) { | |
var distance = Math.round( (end-start)/100 )*100; | |
_gaq.push(["_setCustomVar", index, name, distance, scope]); | |
} | |
}; | |
var onLoadHandler = function() { | |
var onLoadTime = new Date().getTime(); | |
reportTimeSegment(1, "headToOnLoad", headTime, onLoadTime, 3); | |
var webTiming = ( window.msPerformance || | |
window.webkitPerformance || | |
window.mozPerformance ); | |
if( webTiming && webTiming.timing ) { | |
var navTime = webTiming.timing.navigationStart || null; | |
var responseEndTime = webTiming.timing.responseEnd || null; | |
reportTimeSegment(2,"navToResponseEnd", navTime, responseEndTime, 3); | |
reportTimeSegment(3,"navToOnLoad", navTime, onLoadTime, 3); | |
} | |
_gaq.push(["_setAccount","UA-xxxxxxxx-yy"], | |
["_trackPageview"]); | |
}; | |
if(!window.addEventListener) { | |
window.attachEvent("onload", onLoadHandler); | |
} else { | |
window.addEventListener("load", onLoadHandler, false); | |
} | |
})(); | |
//]]> | |
</script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
(function() { | |
var ga = document.createElement('script'); | |
ga.type = "text/javascript"; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(ga,s); | |
})(); | |
//]]> | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment