Data Verification
Confirm Coframe is assigning treatments and sending events correctly
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.
This page provides a set of in-browser checks to confirm that Coframe is correctly assigning experiment treatments and flowing events downstream. The checks here pick up where Testing and Validation ends: that page confirms the SDK loaded without errors; this page confirms it is producing experiment assignments and batching events correctly.
On this page
011. Confirm the SDK script response
The SDK is delivered as a single HTTP response from the edge worker. In the
browser DevTools Network tab, filter for cf.js. Confirm two things:
- The request returns HTTP
200. - The response body contains both baked-in project JSON
(
window.CFQ.push({ projectData: ... })) and the compiled SDK bundle.
A missing or failed cf.js request means the SDK never ran and no data will
flow. If the request is absent or errored, consult
Testing and Validation for the
common causes (ad blockers, Content Security Policy, incorrect script URL).
022. Confirm treatments are assigned
After the SDK initializes, window.Coframe.treatmentsDataV2 holds the active
experiment assignments for this visitor. Its initial value is null; it is
populated after treatment analytics have run.
Open the browser console and inspect the property:
window.Coframe.treatmentsDataV2A populated value is an array of CoframeTreatmentDataV2 objects, one per
active experiment that has final_state: true (terminal in the three-level
coin-flip assignment). If the value is still null, the SDK has either not
finished initializing or this visitor was not placed into any active experiment
— for example, because they are in the project-level global holdout
(coframe_in_global_holdout: true).
See The Coframe Global for the full field
reference for treatmentsDataV2 and the eight fields each entry contains.
033. Subscribe to treatment assignments
To receive treatment data reactively and confirm the bulkCallbackV2 pipeline
is working, push a subscribe command to window.CFQ. The command can be
pushed before or after the SDK loads:
<script>
window.CFQ = window.CFQ || [];
window.CFQ.push({
subscribe: 'treatmentApplied',
bulkCallbackV2: (treatments, rawIds) => {
console.log('[Coframe] treatments', treatments);
}
});
</script>The callback receives an array of CoframeTreatmentDataV2 objects — the same
shape stored in window.Coframe.treatmentsDataV2. If the callback does not
fire, the most likely cause is that cookie consent has not been granted:
bulkCallbackV2 is gated on consent. If you need to receive assignments before
consent is signaled, use bulkCallbackV2WithoutConsent instead — it fires
regardless of consent state.
See Events and Tracking for a full explanation of the consent gate and event delivery model.
044. Inspect the event queue
Coframe.debug exposes three utilities for checking whether events are being
batched and dispatched:
// View the pending event batch without sending it
window.Coframe.debug.queuedEvents
// Check whether the event gate is currently open
window.Coframe.debug.shouldSendEvents()
// Force-flush the pending batch immediately
window.Coframe.debug.flushQueuedEvents()shouldSendEvents() returns false when the SDK is in preview mode
(coframe_variant_id is set in the URL) or when cookie consent has not been
granted. Use queuedEvents to verify which events have accumulated in the
current batch — the default batch size is 32 events, configured via
config.batchSize. Call flushQueuedEvents() to send the batch immediately
without waiting for it to reach that size.
Full documentation for Coframe.debug is at
Preview and Debug.
055. Verify events fire in preview mode
When you are testing a specific variant using coframe_variant_id, the SDK
suppresses event sending by default to avoid polluting live experiment data. To
override this and confirm that analytics hooks fire correctly against a preview
variant, add coframe_should_send_events=true:
https://yoursite.com/landing?coframe_variant_id=var_abc123&coframe_should_send_events=trueThe value must be the string true. With this parameter present,
Coframe.debug.shouldSendEvents() returns true and events flow through the
normal batch pipeline. You can combine this with flushQueuedEvents() and the
bulkCallbackV2 subscription from check 3 to exercise the full analytics path
against a preview variant before going live.
Events sent this way are delivered normally and will appear in your project’s event stream. Use this check in a controlled QA environment.
# Data Verification
Confirm Coframe is assigning treatments and sending events correctly
This page provides a set of in-browser checks to confirm that Coframe is
correctly assigning experiment treatments and flowing events downstream. The
checks here pick up where [Testing and Validation](../docs/testing-and-validation.html)
ends: that page confirms the SDK loaded without errors; this page confirms it is
producing experiment assignments and batching events correctly.
## 1. Confirm the SDK script response
The SDK is delivered as a single HTTP response from the edge worker. In the
browser DevTools Network tab, filter for `cf.js`. Confirm two things:
- The request returns HTTP `200`.
- The response body contains both baked-in project JSON
(`window.CFQ.push({ projectData: ... })`) and the compiled SDK bundle.
A missing or failed `cf.js` request means the SDK never ran and no data will
flow. If the request is absent or errored, consult
[Testing and Validation](../docs/testing-and-validation.html) for the
common causes (ad blockers, Content Security Policy, incorrect script URL).
## 2. Confirm treatments are assigned
After the SDK initializes, `window.Coframe.treatmentsDataV2` holds the active
experiment assignments for this visitor. Its initial value is `null`; it is
populated after treatment analytics have run.
Open the browser console and inspect the property:
JS
```
window.Coframe.treatmentsDataV2
```
A populated value is an array of `CoframeTreatmentDataV2` objects, one per
active experiment that has `final_state: true` (terminal in the three-level
coin-flip assignment). If the value is still `null`, the SDK has either not
finished initializing or this visitor was not placed into any active experiment
— for example, because they are in the project-level global holdout
(`coframe_in_global_holdout: true`).
See [The Coframe Global](../docs/coframe-global.html) for the full field
reference for `treatmentsDataV2` and the eight fields each entry contains.
## 3. Subscribe to treatment assignments
To receive treatment data reactively and confirm the `bulkCallbackV2` pipeline
is working, push a `subscribe` command to `window.CFQ`. The command can be
pushed before or after the SDK loads:
HTML
```
<script>
window.CFQ = window.CFQ || [];
window.CFQ.push({
subscribe: 'treatmentApplied',
bulkCallbackV2: (treatments, rawIds) => {
console.log('[Coframe] treatments', treatments);
}
});
</script>
```
The callback receives an array of `CoframeTreatmentDataV2` objects — the same
shape stored in `window.Coframe.treatmentsDataV2`. If the callback does not
fire, the most likely cause is that cookie consent has not been granted:
`bulkCallbackV2` is gated on consent. If you need to receive assignments before
consent is signaled, use `bulkCallbackV2WithoutConsent` instead — it fires
regardless of consent state.
See [Events and Tracking](../docs/events-and-tracking.html) for a full
explanation of the consent gate and event delivery model.
## 4. Inspect the event queue
`Coframe.debug` exposes three utilities for checking whether events are being
batched and dispatched:
JS
```
// View the pending event batch without sending it
window.Coframe.debug.queuedEvents
// Check whether the event gate is currently open
window.Coframe.debug.shouldSendEvents()
// Force-flush the pending batch immediately
window.Coframe.debug.flushQueuedEvents()
```
`shouldSendEvents()` returns `false` when the SDK is in preview mode
(`coframe_variant_id` is set in the URL) or when cookie consent has not been
granted. Use `queuedEvents` to verify which events have accumulated in the
current batch — the default batch size is 32 events, configured via
`config.batchSize`. Call `flushQueuedEvents()` to send the batch immediately
without waiting for it to reach that size.
Full documentation for `Coframe.debug` is at
[Preview and Debug](../docs/preview-and-debug.html).
## 5. Verify events fire in preview mode
When you are testing a specific variant using `coframe_variant_id`, the SDK
suppresses event sending by default to avoid polluting live experiment data. To
override this and confirm that analytics hooks fire correctly against a preview
variant, add `coframe_should_send_events=true`:
PLAINTEXT
```
https://yoursite.com/landing?coframe_variant_id=var_abc123&coframe_should_send_events=true
```
The value must be the string `true`. With this parameter present,
`Coframe.debug.shouldSendEvents()` returns `true` and events flow through the
normal batch pipeline. You can combine this with `flushQueuedEvents()` and the
`bulkCallbackV2` subscription from check 3 to exercise the full analytics path
against a preview variant before going live.
Events sent this way are delivered normally and will appear in your project’s
event stream. Use this check in a controlled QA environment.
## Related links
- [Testing and Validation](../docs/testing-and-validation.html) —
prerequisite checklist: SDK load, console errors, LCP measurement, flicker
- [Missing Data](../docs/missing-data.html) — troubleshoot when
assignments or events are absent after these checks pass
- [The Coframe Global](../docs/coframe-global.html) — full
`window.Coframe` reference including `treatmentsDataV2` and `debug`
- [Preview and Debug](../docs/preview-and-debug.html) — URL parameters
and `Coframe.debug` utilities
- [Events and Tracking](../docs/events-and-tracking.html) — event types,
batching, consent gating, and `bulkCallbackV2` delivery