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
| Function | Purpose | Since |
|---|---|---|
runScript(fn) | Runs an experiment after the DOM is ready | v2.0.0 |
mountExperiment(selector, fallback?, position?, options?) | Creates and injects the experiment container into the DOM | v2.0.0 |
waitFor(selectors, callback) | Polls until all CSS selectors match, then runs the 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 | Current package |
getPathSegments(path?) | Splits a path into non-empty pathname segments | Current package |
getMarket(path?) | Returns the lowercase first path segment | Current package |
log(...args) | Logs only in development bundles | Current package |
debug(...args) | Logs when opt-in debug mode is enabled | Current 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.