Browserscope

User Testsalpha HOWTO

Browserscope wants to help you store and aggregate your browser test data. Storing your data in our system gives you the benefit of not having to write a complex, scaling backend with a user agent parser built in. You can download all of your data for offline processing, and we provide a stats table widget that you can embed on your page which shows the median results for your tests.

This is definitely a release early/often feature, and we want to be explicit that things may change or break in the API while we're in alpha mode.

Steps to set up your test

  1. Write a test page and host it on your server. You'll need to be able to access the results of your test in Javascript in order to send the results to Browserscope.
    Also, you might consider executing your test via a button, and letting your users know that you'll be recording the results (something like what we do for the main categories here on Browserscope).
  2. Sign in to Browserscope.
  3. Create a record for your test on the settings page.
  4. Add the following code to your test page, so that it executes after your test is complete, allowing you to format a _bTestResults object.
    <script>
    // To save data in Browserscope do something like the following.
    // The syntax is 'test_key': 'value' where test_key is some unique
    // identifier for a piece of data you want to store (no = or , allowed)
    // and value is a numeric value from 0 through 10000.
    var _bTestResults = {
      'test_one': '1',
      'test_two': '0'
    };
    
    // Beacon the results to Browserscope.
    (function() {
      var _bTestKey = 'CHANGE-THIS-TO-YOUR-TEST-KEY';
      var _bScript = document.createElement('script');
      _bScript.src = 'http://www.browserscope.org/user/beacon/' + _bTestKey;
      _bScript.setAttribute('async', 'true');
      var scripts = document.getElementsByTagName('script');
      var lastScript = scripts[scripts.length - 1];
      lastScript.parentNode.insertBefore(_bScript, lastScript);
    })();
    </script>
    
    * Don't forget to set the _bTestKey in the snippet to your test ID, which you can find on your settings page.
    You can execute a callback Javascript function after the results data is sent to Browserscope by adding the following parameter to _bScript.src:
    _bScript.src += '?callback=YOUR-FUNCTION-NAME';
    You can bypass Browserscope's IP throttling feature (while testing) by adding the the following parameter to _bScript.src:
    _bScript.src += '?sandboxid=YOUR-SANDBOX-ID';
    Just remember not to publish this widely and/or change it after you're done testing so that no one can corrupt your dataset.
  5. Troubleshooting? Check out a working test/beacon example and read the code.
  6. Send your test page link to all your friends!
  7. Check out the "Table" and "CSV" links on the settings to see your results in realtime. (We are still working on how to handle CSV downloads for large datasets.)
  8. You can embed the results table in a blog post or on your site using an iframe. Check out a working iframe example
    <iframe
      src="http://www.browserscope.org/user/tests/table/YOUR-TEST-ID?v=3&layout=simple"></iframe>
    
    Parameters:
      v=0: Shows the "Top Browsers" list. (DEFAULT)
      v=1: Shows the browser families.
      v=2: Shows the minor browser versions.
      v=3: Shows all browser versions.
      o=html: The browserscope HTML table (DEFAULT, good for iframe src)
      o=js: Good as a script src value, renders the table on your page.
      o=gviz_data: Preformatted gviz output, suitable for gviz widgets.
      o=json: A JSON encoded response with all the data.
      callback=yourFnnName: When o=json, wraps json output in "yourFnName()"
      layout=full: Includes links and headers we use in Browserscope (o=html, DEFAULT).
      layout=simple: Hides a variety of things, good for embedding (o=html).
      f=test_key_1,test_key_2: Limit results to these test_keys.

Create a test record with the API

  1. Grab your API key from the settings page. You should then be able to create tests programmatically with a GET or a POST request, like:
    /user/tests/create?api_key=YOUR-API-KEY&name=Some test name&description=A longer description&url=http://yourtest.com/page.html
  2. The response, if everything is successful, is a JSON string with the newly created test_key.
    {"test_key": "thetestkeyforthenewtest"}

We want your feedback!

Please send any feedback and ideas about these features to the Google Group

Home | FAQ | UA Parser | News | Browser Resources | Code | Submit a Bug | Mailing List | Contact