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:studiesand unenroll this profile from anything that might interfere - On the Experimenter page for your experiment, select the contents of the
Recipe JSONfield from theSummarytab, and copy it into your Copy/Paste buffer - Navigate to the Nimbus Developer Tools
JSON Enrollmentpage - Paste the JSON from the
Recipe JSONfield in the provided textarea - Click
Enroll - Reload
about:studies, and you should see the experiment
Feature Configuration Enrollment
- Load
about:studiesand unenroll this profile from anything that might interfere - Navigate to the Nimbus Developer Tools
Feature Configurationpage. - Select the feature ID from the dropdown
- Set the
isRolloutoption to eithertrueorfalseas 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.debugtotrue
Enable the Browser Toolbox
- In
about:config, set:devtools.chrome.enabledtotruedevtools.debugger.remote-enabledtotrue
Prepare a few things:
- Load
about:studiesand unenroll this profile from anything that might interfere - On the Experimenter page for your experiment, select the contents of the
Recipe JSONfield from theDetailstab, 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 wantlet 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);