Variations
Variation numbering
Variations are numbered from 1. In a standard A/B test:
v1— control (no change, or baseline treatment)v2— treatment Av3— treatment B (A/B/C test)
Adding a variation manually
The scaffolder generates v1 and any additional variations you requested. To add another variation later:
Copy the existing variation directory:
bashcp -r src/js/v1 src/js/v2Open
src/js/v2/index.jsxand update:- The
uniqueBuildcall:uniqueBuild('v1')→uniqueBuild('v2') - The tracking label:
'my-experiment: v1 cta clicked'→'my-experiment: v2 cta clicked' - Any selectors or component props specific to this variation
- The
Copy the variation styles if applicable:
bashcp src/js/v1/styles.module.scss src/js/v2/styles.module.scssBuild to confirm the new variation compiles:
bashpnpm build # dist/v1/v1.js # dist/v2/v2.js
Developing a specific variation
pnpm start 0 # variation 1 (src/js/v1/)
pnpm start 1 # variation 2 (src/js/v2/)
pnpm start 2 # variation 3 (src/js/v3/)The index is always zero-based. Only one variation is watched at a time — switch by restarting with a different number.
Production build
pnpm buildBuilds all variations in parallel. Output:
dist/
├── v1/
│ └── v1.js
├── v2/
│ └── v2.js
└── vN/
└── vN.jsBiome runs before the build. The build aborts if linting fails.
Dedup guard
Every variation entry point checks for the data-injected-experiment attribute before doing anything:
const { uniqueId, injectedSelector } = uniqueBuild('v1');
if (!target || document.querySelector(injectedSelector)) return;The uniqueId is {testName}-v1. The guard prevents the experiment from injecting twice if Adobe Target fires the custom code more than once — which can happen on single-page applications during navigation or re-renders.
SPA pages
On Samsung's SPA pages, Adobe Target may re-execute custom code on route changes. The dedup guard is the primary defence. Do not remove it.