Skip to content

Configuration

Experiment projects have two configuration files with distinct responsibilities.

experiment.config.js

Top-level runtime configuration. Located at the project root.

js
export default {
    targetUrl: 'https://www.samsung.com/uk/smartphones/all-smartphones/',
    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.
globalObjectstringThe IIFE window namespace. The bundle registers as window[globalObject]. Set at scaffold time - change only if it conflicts with another experiment.
includeEmergencyBrakebooleanScaffolded compatibility setting. The current build and runtime do not read it; verify the deployment layer before relying on it.
live.variationnumber | stringVariation used by pnpm live. Accepts a zero-based index or folder name such as v2.
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

Experiment-specific values. This is the first file you edit when setting up an experiment.

product-card boilerplate

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

export const locale =
    (typeof window !== 'undefined' ? window.location.pathname : '').split('/').filter(Boolean)[0] || '';

export const MODEL_CODE_MAP = {
    default: 'SM-XXXXXXX',
    uk: 'SM-A556BZKAEUB',
    de: 'SM-A556BZKADBT',
};

export const MULTI_MODEL_CODES_MAP = {
    default: ['SM-XXXXXXX'],
};

const translations = {
    uk: { title: 'Upgrade today', from: 'From', ctaText: 'Shop now' },
    de: { title: 'Jetzt upgraden', from: 'Ab', ctaText: 'Jetzt kaufen' },
};
export const translationByMarket = translations[locale] || translations.uk;

minimal boilerplate

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.
localestringFirst path segment of the current URL (e.g. uk, de, fr). Resolved at runtime.
MODEL_CODE_MAPobject(product-card only) Maps locale codes to Samsung model codes. Used by modelCode() in helpers. Include a default fallback.
MULTI_MODEL_CODES_MAPobject(product-card only) Maps locales to arrays used by fetchProductCards().
translationsobjectLocale-keyed copy strings.
translationByMarketobjecttranslations[locale] with a translations.uk fallback. Import this directly in your component.
buttonTextstringMinimal boilerplate button copy.

Finding the right primary selector

Use your browser's DevTools to inspect the page and pick a stable, unique CSS class or attribute selector near where the experiment should inject. Avoid selectors that change across page loads.

translations is private in the generated module. Import translationByMarket from variation code.

Internal tool - Samsung / Sogody experimentation team