Skip to content

Installation ​

Create a new experiment ​

Run the create command with your project name:

bash
npx @sogody/experiment-framework my-experiment
npx @sogody/experiment-framework my-experiment --control

The CLI asks a few setup questions, creates the project, and installs its dependencies. Pass --control when the experiment needs a separate impression-only entry for the unchanged page. The CLI can also configure Playwright and run an initial smoke test.

CLI prompts ​

PromptDefaultWhat it controls
Number of variations1Generates src/js/v1/ through src/js/vN/. Pick 2 for A/B, 3 for A/B/C.
Window namespacesgdThe IIFE output name on window, such as window.sgd. It must be a valid JavaScript identifier. Change it only if another experiment on the page uses the same name.
Include emergency braketrueSets runtime.includeEmergencyBrake in experiment.config.js. When enabled, runScript() checks the Adobe Target emergency-brake configuration before running the experiment.
Enable E2E testingfalseGenerates e2e/, playwright.config.js, and wires up pnpm test:e2e. Enable if you have a stable preview URL to test against.
Base URL (E2E only)https://samsung.comThe root URL for Playwright tests.
Markets (E2E only)-Selects one or more groups or individual markets for the generated tests. See the Markets reference.
Run smoke test (E2E only)falseRuns pnpm build and pnpm test:e2e immediately after setup.

Market groups expand to their member countries. You can mix a group with individual markets; the resolver removes duplicates and writes the result in the framework's canonical order. The first resolved market becomes the default targetUrl for pnpm live.

After scaffolding ​

After scaffolding, start the watcher for the first variation:

bash
cd my-experiment

# Watch variation 1 - rebuilds on save and copies IIFE to clipboard
pnpm start 0

Paste the copied bundle into the matching Adobe Target variation, save, and refresh the preview.

Agent guidance ​

The scaffold creates tracked AGENTS.md and CLAUDE.md files. They direct coding tools to the version-matched guides installed with @sogody/experiment-framework, starting at node_modules/@sogody/experiment-framework/llms.txt.

See AI Project Support for the discovery flow and the safe refresh command for older projects.

Current scaffold

The CLI now generates one generic button template. Add experiment-specific data loading or custom components in the generated project when needed.

Existing directories

If the destination directory already exists and is not empty, the CLI asks before continuing. It does not remove unrelated files from that directory.

Internal tool - Samsung / Sogody experimentation team

Help improve the frameworkShare an idea or friction you encountered.Share framework feedback(opens in a new tab)