Skip to content

Instantly share code, notes, and snippets.

@dmose
Last active May 24, 2022 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmose/eb65fe03b38090c2157f92532c9da6dd to your computer and use it in GitHub Desktop.
Save dmose/eb65fe03b38090c2157f92532c9da6dd to your computer and use it in GitHub Desktop.
Desktop Local Experiment Iteration
id title slug
desktop-enroll-locally
Desktop Local Experiment Iteration
/desktop-enroll-locally

Debugging an experiment from experimenter locally

Trying to iterate on an experiment in Preview on experimenter.services.mozilla.com can be painful, because even after you change something and post to preview, you have a wait a while for the updated recipe to be propagated to the CDN.

Enable Nimbus debugging

  • In about:config, set or create:
    • nimbus.debug to true
    • devtools.chrome.enabled to true
    • devtools.debugger.remote-enabled to true
  • Open Tools > Browser Tools > Browser Toolbox
  • Load about:studies and unenroll this profile from anything that might interfere
  • Switch to the browser console
  • In the input box, do the following:
    • const { ExperimentManager: em } = ChromeUtils.import("resource://nimbus/lib/ExperimentManager.jsm");
    • let recipe = paste_recipe_json_here ;
    • const branchSlug = 'treatment-a'; # or whatever branch you want
    • let branch = recipe.branches.find(b => b.slug == branchSlug);
    • em.forceEnroll(recipe, branch);
  • Reload about:studies, and you should see the experiment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment