Skip to content

Framework API

Generated variation entry points import their runtime helpers from @sogody/experiment-framework/framework.

js
import {
    debug,
    getMarket,
    getPath,
    getPathSegments,
    log,
    mountExperiment,
    runScript,
    setupTracking,
    trackAAEvent,
    waitFor,
    watchFor,
} from '@sogody/experiment-framework/framework';

Exports

FunctionPurposeSince
runScript(fn)Runs an experiment after the DOM is readyv2.0.0
mountExperiment(selector, fallback?, position?, options?)Creates and injects the experiment container into the DOMv2.0.0
waitFor(selectors, callback)Polls until all CSS selectors match, then runs the callbackv2.0.0
watchFor(selector, callback, options?)MutationObserver-based alternative to waitForv2.0.0
trackAAEvent(evar, event, data)Fires an Adobe Analytics event via the global s objectv2.0.0
setupTracking(container, options)Attaches click tracking to a rendered elementv2.0.0
getPath()Returns the current path, query string, and hashCurrent package
getPathSegments(path?)Splits a path into non-empty pathname segmentsCurrent package
getMarket(path?)Returns the lowercase first path segmentCurrent package
log(...args)Logs only in development bundlesCurrent package
debug(...args)Logs when opt-in debug mode is enabledCurrent package

The runtime lives in the installed @sogody/experiment-framework package, not in generated project source.

Version labels

Current package means the helper exists in the package version documented by this site but was not part of the original v2.0.0 API.

Internal tool - Samsung / Sogody experimentation team

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