Skip to content

Configuration

Experiment projects have two configuration files with distinct responsibilities.

experiment.config.js

This file sits at the project root and configures the build and live-preview tools.

js
export default {
    targetUrl: 'https://www.samsung.com/uk/smartphones/all-smartphones/',
    runtime: {
        globalObject: 'sgd',
        includeEmergencyBrake: true,
    },
    live: {
        variation: 0,
        overlay: 'visible',
        profile: 'ephemeral',
    },
};
FieldTypeDescription
targetUrlstringPage opened by pnpm live. The scaffold derives it from E2E market answers when available.
runtime.globalObjectstringThe IIFE window namespace. The bundle registers as window[globalObject]. Change the scaffolded value only if it conflicts with another experiment.
runtime.includeEmergencyBrakebooleanEnables the runtime emergency-brake check in runScript().
live.variationnumber | stringVariation used by pnpm live. Accepts a zero-based index or discovered folder name such as v2 or control.
live.overlay'visible' | 'hidden'Shows or hides the live-injection status overlay.
live.profile'ephemeral' | 'shared'Uses a temporary browser profile or a persistent OS-cache profile.

src/config.js

Keep experiment-specific selectors and copy here. This is usually the first file you edit.

js
export const selectors = {
    primary: '.some-page-element',
    fallbacks: ['.alternate-selector', 'body'],
};

export const buttonText = 'Click Me';
ExportTypeDescription
selectors.primarystringCSS selector for the DOM element the experiment injects adjacent to. Must be unique and stable on the target page.
selectors.fallbacksstring[]Fallback selectors used by mountExperiment if selectors.primary yields no match. Keep them ordered from most specific to broadest.
buttonTextstringScaffolded button copy.

Finding the right primary selector

Inspect the page in DevTools and choose a stable, unique class or attribute near the injection point. Avoid session-specific IDs, generated class names, and long nth-child chains.

Add locale, translations, model codes, or API-specific values only when the experiment needs them.

Internal tool - Samsung / Sogody experimentation team

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