S peed-
S urvey

Instrumentation Instructions


The measurements are taken by JavaScript instrumentation. 95% of visitors to most websites are using browsers capable of making accurate measurements. The instrumentation code is the same for any page on your website, which makes it suitable for use in common header and footer files or dynamically generated pages. JavaScript, for those who are unfamiliar, runs on the visitors browser and so does not affect the speed of the server.
There are two parts to the instrumentation code, one that you put at the top of the page and one that you put at the bottom. The top part contains configuration information that allows the correct number of measurements to be taken and provides information about where to send the results. To insert the code all you need is a text editor like Windows notepad.

Before you start

You will need the following:
  • A copy of the website source material (html,cgi,php files etc.) that you can edit.
  • An email address to which we can send the results. All measurements are collated under this address, so it should not change unless absolutely necessary.
  • An estimate of the traffic that your instrumented pages are likely to attract. Where possible this should be specific to the page rather than your website as a whole. You should not inflate this figure as it will lead to too few measurements.
  • This page.

Not quite ready?

Have a read of the FAQ to put your mind at ease.

Instrumenting a page

You should place the following code section immediately after the <body> tag in the html. And you will need to fill in the relevant configuration information.
<script language="JavaScript1.1" type="text/javascript">
<!-- Copyright Speed-Survey 2002 see www.speed-survey.net/v1_license.html
  var ss_vol = your monthly traffic;
  var ss_person = "report email user (before the @ symbol)";
  var ss_domain = "report email domain (after the @ symbol)";
  var ss_server = "server identifier";
  var ss_tzero = new Date();
// end -->
For example this Speed-Survey page has only low traffic, sends the report to the webmaster and is served from only one server. To see how this page sets its configuration just view the source.

The next step is to place the following code immediately before the </body> tag. You do not need to make any changes to this section.
<script language="JavaScript1.1" type="text/javascript">
<!-- Copyright Speed-Survey 2002 see www.speed-survey.net/v1_license.html
  var ss_tone = new Date();

  function ss_report (comment) {
    rep = "http://www.speed-survey.net/r_v1.php/";
    rep += escape(ss_value) + "/";
    rep += escape(comment) + "/";
    rep += ss_sminus + "/";
    rep += (ss_tzero.getTime() - ss_sminus) + "/";
    rep += (ss_tone.getTime() - ss_tzero.getTime()) + "/";
    rep += (ss_ttwo.getTime() - ss_tone.getTime()) + "/";
    rep += escape(ss_person) + "/";
    rep += escape(ss_domain) + "/";
    rep += escape(ss_server) + "/";
    rep += escape(navigator.appName) + "/";
    rep += escape(navigator.appVersion) + "/";
    rep += escape(document.lastModified) + "/";
    rep += escape(document.URL);
    i = new Image();
    i.src = rep;

  function ss_pretime() {
    ss_tminus = new Date();
    document.cookie = "sstminus=" + ss_tminus.getTime();
    return true;

  function ss_abortedImage() {

  function ss_nextImage() {
    if ( ss_count < 0 ) {
      ss_ttwo = new Date();
    else {
      img = new Image();
      img.onload = ss_nextImage;
      img.onabort = ss_abortedImage;
      img.onerror = ss_abortedImage;
      img.src = document.images[ss_count].src;

  var ss_onein = ss_vol / 14400;
  var ss_value = Math.random() * ss_onein;
  var ss_sminus = 0;
  var ss_ttwo = ss_tone;
  if ( ss_value < 1.0 ) {
    st = document.cookie.indexOf("sstminus=");
    if ( st != -1 ) {
      st += 9;
      en = document.cookie.indexOf(";",st);
      if ( en != -1 ) {
        ss_sminus = document.cookie.substring(st,en);
      else {
        ss_sminus = document.cookie.substring(st);
    var ss_count = document.images.length;

  for (var ss_d = 0; ss_d < document.links.length; ss_d++) {
    document.links[ss_d].onclick = ss_pretime;

// end -->
Please ensure that you copy the code correctly. Save and deploy the code to start the measuring process.
The code uses only global variables and function names that start with ss_ and so you are unlikely to get any incompatabilities with other JavaScript on your pages. To track time between pages a cookie called sstminus is used.

What happens then

You will receive a confirmation email to let you know that the Speed-Survey is recording your site's delivery performance. Then at the end of the month you will receive your report. Good Luck.

Your feedback please...

Resource Links
Example Report