Framework API
create-experiment/framework is the experiment runtime export used by generated variation entry points.
js
import {
debug,
getMarket,
getPath,
getPathSegments,
log,
mountExperiment,
runScript,
setupTracking,
trackAAEvent,
waitFor,
watchFor,
} from 'create-experiment/framework';Exports
| Function | Purpose | Since |
|---|---|---|
runScript(fn) | Wraps experiment entry point - ensures DOM is ready | v2.0.0 |
mountExperiment(selector, fallback?, position?) | Creates and injects the experiment container into the DOM | v2.0.0 |
waitFor(selectors, callback) | Polls until CSS selectors match, then fires callback | v2.0.0 |
watchFor(selector, callback, options?) | MutationObserver-based alternative to waitFor | v2.0.0 |
trackAAEvent(evar, event, data) | Fires an Adobe Analytics event via the global s object | v2.0.0 |
setupTracking(container, options) | Attaches click tracking to a rendered element | v2.0.0 |
getPath() | Returns the current path, query string, and hash | Unreleased |
getPathSegments(path?) | Splits a path into non-empty pathname segments | Unreleased |
getMarket(path?) | Returns the lowercase first path segment | Unreleased |
log(...args) | Logs only in development bundles | Unreleased |
debug(...args) | Logs when opt-in debug mode is enabled | Unreleased |
The runtime lives in the installed create-experiment package, not in generated project source.
Version labels
Unreleased means the helper exists on the repository main branch but is newer than the latest 2.0.2 changelog entry.