The Coframe Global
window.Coframe — runtime state, treatment data, and debug utilities
Copy this guide and your current settings as a prompt for your AI agent.
Preview agent promptSee the guide, code and settings included when you copy.
window.Coframe is the SDK’s runtime object. It is populated during SDK
initialisation (Coframe.init()) and holds the resolved identity, experiment
assignments, and debug tooling for the current page session.
On this page
01Properties
| Property | Type | Description |
|---|---|---|
projectId |
string |
Initialised to ''; set from config.projectId during init. |
orgId |
string |
Initialised to ''; set from the resolved project’s org_id during init. |
userToken |
string |
Initialised to ''; set to either a generated or cookie-stored UUID, or to the customer-supplied token from CFQ.setUserToken. |
sessionId |
string |
UUID generated at script-load time via generateUUID(). Persists for the browser page session and is used as the coframe_impression_id in treatment data. |
status |
CoframeStatus |
SDK lifecycle state object. See sub-fields below. |
treatmentsDataV2 |
CoframeTreatmentDataV2[] | null |
Populated after treatment analytics run. Contains one entry per active experiment that has final_state: true (terminal in the 3-level coin-flip tree). Starts as null. |
experimentInfo |
ExperimentInfo[] |
Raw experiment assignment results for all levels of the coin-flip tree. Each entry has final_state: boolean, level: ExperimentLevel, and variant/experiment IDs/slugs. Starts as []. |
status sub-fields
| Field | Type | Meaning |
|---|---|---|
initialized |
boolean |
true after the first applyChanges call completes. |
elapsedFromInstallation |
number | undefined |
Milliseconds from config.startTime to init completion. |
elapsedFromExecution |
number | undefined |
Milliseconds from SDK script execution to init completion. |
trackOnlyActivatedFrames |
boolean | undefined |
Mirrors project.settings.track_only_activated_frames. |
events |
Array | undefined |
Per-event debug records. |
tags |
ProjectTag[] | undefined |
Active project tags. |
02Treatment data
Each entry in Coframe.treatmentsDataV2 is a CoframeTreatmentDataV2 object
(the name used in the callback snippets; the SDK source interface is
TreatmentDataV2). The fields are the same ones delivered to the
bulkCallbackV2 subscription callback.
Experiment Assignment is the
canonical reference for these fields and explains how entries are produced
(holdout nesting, coin-flip levels, baseline vs. variant assignment); the table
below is a quick summary.
The 8 fields of CoframeTreatmentDataV2:
| Field | Type | Description |
|---|---|---|
coframe_experiment_id |
string |
Holdout experiment id if available; otherwise the direct experiment id. From the customer’s perspective the holdout nesting is transparent. |
coframe_experiment_slug |
string |
Human-readable experiment name; used for debugging and analytics logging. |
coframe_variant_id |
string |
The raw variant id as stored. |
coframe_variant_slug |
string |
'baseline', 'global_holdout', or the variant name. |
coframe_user_token |
string |
The visitor identity token for this session. |
coframe_impression_id |
string |
Session UUID (Coframe.sessionId); uniquely identifies the session/impression. |
coframe_in_global_holdout |
boolean |
true if the visitor is in the project-level global holdout (receives no variants). |
coframe_in_exp_baseline |
boolean |
true if the visitor is in the experiment-level baseline/holdout control group. |
03Debug utilities
Coframe.debug is an object of debugging utilities. It is not part of the
public API.
| Utility | Type | Description |
|---|---|---|
logs |
LogEntry[] |
SDK warning/error log history. |
project |
Project | undefined |
Resolved project payload. |
frames |
Frame[] | undefined |
Active frames after filtering. |
laneClaims |
Claims | undefined |
Mutual-exclusion lane assignments for this visitor. |
getSelector |
function | Compute a UniversalSelector for a DOM element. |
getElement |
function | Resolve a UniversalSelector to a DOM element. |
getElementUniversal |
function | Broader element resolver. |
waitForCmd |
function | Await a CFQ command from the console. |
flushQueuedEvents() |
function | Manually flush the pending event batch. |
queuedEvents |
ref | Reference to the pending events array. |
shouldSendEvents |
function | Check current event-gate state. |
querySelector |
function | SDK DOM query wrapper. |
For a task-oriented guide to using these utilities — including preview mode and URL parameters — see Preview and Debug.
See also:
CFQ Commands — window.CFQ command
reference including subscribe, conversion, and identity commands.
Preview and Debug — URL parameters
and debug utilities for development and QA.
# The Coframe Global window.Coframe — runtime state, treatment data, and debug utilities `window.Coframe` is the SDK’s runtime object. It is populated during SDK initialisation (`Coframe.init()`) and holds the resolved identity, experiment assignments, and debug tooling for the current page session. ## Properties Property | Type | Description | `projectId` | `string` | Initialised to `''`; set from `config.projectId` during init. | `orgId` | `string` | Initialised to `''`; set from the resolved project’s `org_id` during init. | `userToken` | `string` | Initialised to `''`; set to either a generated or cookie-stored UUID, or to the customer-supplied token from `CFQ.setUserToken`. | `sessionId` | `string` | UUID generated at script-load time via `generateUUID()`. Persists for the browser page session and is used as the `coframe_impression_id` in treatment data. | `status` | `CoframeStatus` | SDK lifecycle state object. See sub-fields below. | `treatmentsDataV2` | `CoframeTreatmentDataV2[] | null` | Populated after treatment analytics run. Contains one entry per active experiment that has `final_state: true` (terminal in the 3-level coin-flip tree). Starts as `null`. | `experimentInfo` | `ExperimentInfo[]` | Raw experiment assignment results for all levels of the coin-flip tree. Each entry has `final_state: boolean`, `level: ExperimentLevel`, and variant/experiment IDs/slugs. Starts as `[]`. | `status` sub-fields Field | Type | Meaning | `initialized` | `boolean` | `true` after the first `applyChanges` call completes. | `elapsedFromInstallation` | `number | undefined` | Milliseconds from `config.startTime` to init completion. | `elapsedFromExecution` | `number | undefined` | Milliseconds from SDK script execution to init completion. | `trackOnlyActivatedFrames` | `boolean | undefined` | Mirrors `project.settings.track_only_activated_frames`. | `events` | `Array | undefined` | Per-event debug records. | `tags` | `ProjectTag[] | undefined` | Active project tags. | ## Treatment data Each entry in `Coframe.treatmentsDataV2` is a `CoframeTreatmentDataV2` object (the name used in the callback snippets; the SDK source interface is `TreatmentDataV2`). The fields are the same ones delivered to the `bulkCallbackV2` subscription callback. [Experiment Assignment](../docs/experiment-assignment.html) is the canonical reference for these fields and explains how entries are produced (holdout nesting, coin-flip levels, baseline vs. variant assignment); the table below is a quick summary. The 8 fields of `CoframeTreatmentDataV2`: Field | Type | Description | `coframe_experiment_id` | `string` | Holdout experiment id if available; otherwise the direct experiment id. From the customer’s perspective the holdout nesting is transparent. | `coframe_experiment_slug` | `string` | Human-readable experiment name; used for debugging and analytics logging. | `coframe_variant_id` | `string` | The raw variant id as stored. | `coframe_variant_slug` | `string` | `'baseline'`, `'global_holdout'`, or the variant name. | `coframe_user_token` | `string` | The visitor identity token for this session. | `coframe_impression_id` | `string` | Session UUID (`Coframe.sessionId`); uniquely identifies the session/impression. | `coframe_in_global_holdout` | `boolean` | `true` if the visitor is in the project-level global holdout (receives no variants). | `coframe_in_exp_baseline` | `boolean` | `true` if the visitor is in the experiment-level baseline/holdout control group. | ## Debug utilities `Coframe.debug` is an object of debugging utilities. It is not part of the public API. Utility | Type | Description | `logs` | `LogEntry[]` | SDK warning/error log history. | `project` | `Project | undefined` | Resolved project payload. | `frames` | `Frame[] | undefined` | Active frames after filtering. | `laneClaims` | `Claims | undefined` | Mutual-exclusion lane assignments for this visitor. | `getSelector` | function | Compute a UniversalSelector for a DOM element. | `getElement` | function | Resolve a UniversalSelector to a DOM element. | `getElementUniversal` | function | Broader element resolver. | `waitForCmd` | function | Await a CFQ command from the console. | `flushQueuedEvents()` | function | Manually flush the pending event batch. | `queuedEvents` | ref | Reference to the pending events array. | `shouldSendEvents` | function | Check current event-gate state. | `querySelector` | function | SDK DOM query wrapper. | For a task-oriented guide to using these utilities — including preview mode and URL parameters — see [Preview and Debug](../docs/preview-and-debug.html). See also: [CFQ Commands](../docs/cfq-commands.html) — `window.CFQ` command reference including `subscribe`, `conversion`, and identity commands. [Preview and Debug](../docs/preview-and-debug.html) — URL parameters and debug utilities for development and QA.