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.
Option A: Enrollment via Nimbus Developer Tools
Nimbus Developer Tools provides a simple interface to debug experiments. You can download and install the extension from the Nimbus DevTools GitHub release page. Here are some of the ways you can use it to debug experiments locally:
Recipe JSON Enrollment
- 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 theSummary
tab, and copy it into your Copy/Paste buffer - Navigate to the Nimbus Developer Tools
JSON Enrollment
page - Paste the JSON from the
Recipe JSON
field in the provided textarea - Click
Enroll
- Reload
about:studies
, and you should see the experiment
Feature Configuration Enrollment
- Load
about:studies
and unenroll this profile from anything that might interfere - Navigate to the Nimbus Developer Tools
Feature Configuration
page. - Select the feature ID from the dropdown
- Set the
isRollout
option to eithertrue
orfalse
as needed - Paste the feature configuration JSON into the textarea.
- Click
Enroll
. - Reload
about:studies
, and you should see the experiment
For a more comprehensive overview of the Nimbus Developer Tools, including additional features beyond this, check out the Nimbus Developer Tools Guide.
Option B: Manual Enrollment via Browser Console
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);