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:nimbus.debug
totrue
Enable the Browser Toolbox
- In
about:config
, set:devtools.chrome.enabled
totrue
devtools.debugger.remote-enabled
totrue
Prepare a few things:
- Load
about:studies
and unenroll this profile from anything that might interfere - On the Experimenter page for your experiment, select the contents of the
Recipe JSON
field from theDetails
tab, and copy it into your Copy/Paste buffer
Do the Enrollment
- Open
Tools > Browser Tools > Browser Toolbox
- Switch to the browser console
- In the input area, do the following:
const branchSlug = 'treatment-a'; // or whatever branch you want
let recipe =
paste_recipe_json_here;
const { ExperimentManager: em } = ChromeUtils.importESModule("resource://nimbus/lib/ExperimentManager.sys.mjs");
let branch = recipe.branches.find(b => b.slug == branchSlug);
em.forceEnroll(recipe, branch);