Created
June 30, 2010 10:57
-
-
Save alexyoung/458518 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>DailyJS Boomerang Example</title> | |
</head> | |
<body> | |
<h1>Boomerang Test</h1> | |
<div id="results"> | |
</div> | |
<script src="boomerang.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// Since we don't set a beacon_url, we'll just subscribe to the before_beacon function | |
// and print the results into the browser itself. | |
BOOMR.subscribe('before_beacon', function(o) { | |
var html = "", t_name, t_other, others = []; | |
if(o.t_done) { html += "This page took " + o.t_done + " ms to load<br>"; } | |
if(o.t_other) { | |
t_other = o.t_other.replace(/\|/g, ' = ').split(','); | |
html += "Other timers measured: <br>"; | |
for(var i=0; i<t_other.length; i++) { | |
html += " " + t_other[i] + " ms<br>"; | |
} | |
} | |
if(o.bw) { html += "Your bandwidth to this server is " + parseInt(o.bw/1024) + "kbps (±" + parseInt(o.bw_err*100/o.bw) + "%)<br>"; } | |
if(o.lat) { html += "Your latency to this server is " + parseInt(o.lat) + "±" + o.lat_err + "ms<br>"; } | |
var r = document.getElementById('results'); | |
r.innerHTML = html; | |
for(var k in o) { | |
if(!k.match(/^(t_done|t_other|bw|lat|bw_err|lat_err|u|r2?)$/)) { | |
others.push(k + " = " + o[k]); | |
} | |
} | |
if(others.length) { | |
r.innerHTML += "Other parameters:<br>"; | |
for(var i=0; i<others.length; i++) { | |
var t = document.createTextNode(others[i]); | |
r.innerHTML += " "; | |
r.appendChild(t); | |
r.innerHTML += "<br>"; | |
} | |
} | |
}); | |
BOOMR.init({ | |
user_ip: '10.0.0.1' | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to use a different cookie name for RT and BW. If you use the same cookie name, the two plugins will overwrite each others' data. Furthermore, the RT cookie is a session cookie and should not live for longer than 5 minutes. The BW cookie needs to live for 7 days. It's best to leave these at their default values.