Skip to content

Instantly share code, notes, and snippets.

@alexyoung
Created June 30, 2010 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexyoung/458518 to your computer and use it in GitHub Desktop.
Save alexyoung/458518 to your computer and use it in GitHub Desktop.
<!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 += "&nbsp;&nbsp;&nbsp;" + t_other[i] + " ms<br>";
}
}
if(o.bw) { html += "Your bandwidth to this server is " + parseInt(o.bw/1024) + "kbps (&#x00b1;" + parseInt(o.bw_err*100/o.bw) + "%)<br>"; }
if(o.lat) { html += "Your latency to this server is " + parseInt(o.lat) + "&#x00b1;" + 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 += "&nbsp;&nbsp;&nbsp;";
r.appendChild(t);
r.innerHTML += "<br>";
}
}
});
BOOMR.init({
user_ip: '10.0.0.1'
});
</script>
</body>
</html>
@bluesmoon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment