Tracking Settings
Conversion events, tracking-only mode, and the analytics treatment callback
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 covers three tracking-related configuration options: firing conversion events, enabling tracking-only mode, and subscribing to the analytics treatment callback that feeds your existing analytics platform.
01Conversion Events
A conversion event tells Coframe that a visitor completed a meaningful action — a purchase, a sign-up, a checkout step — so that the action can be counted as a metric outcome for any active experiments.
Push a conversion command to window.CFQ at the point in your code where
the action occurs:
<script>
window.CFQ = window.CFQ || [];
window.CFQ.push({
conversion: {
metricName: 'purchase_completed',
value: 99.99
}
});
</script>Replace purchase_completed with the metric name you configured for your
experiment. The value field is optional and can carry a numeric payload
such as revenue or quantity.
02Tracking-Only Mode
Setting trackingOnly: true in your SDK options puts Coframe into a
passive-observation mode. In this mode, Coframe records impressions and
conversion events but does not apply any treatment to the page. No elements
are modified and no anti-flicker behavior runs.
This mode is useful during an instrumentation phase, when you want to validate that events are firing correctly before activating experiments, or when you need to run Coframe on pages where visual modification is not yet appropriate.
See SDK Options for the full list of options and their defaults.
03Analytics Treatment Callback
When Coframe applies a treatment to the page, it can notify your analytics
platform so you can record the experiment assignment alongside the rest of
your event stream. Subscribe to treatmentApplied by pushing a
bulkCallbackV2 handler to window.CFQ:
window.CFQ = window.CFQ || [];
window.CFQ.push({
subscribe: 'treatmentApplied',
bulkCallbackV2: (treatments) => {
// TODO: Send all treatments to your analytics platform
treatments.forEach(treatment => {
console.log('[Coframe] treatment:', treatment);
});
}
});The callback receives an array of treatments. Each treatment is a
treatmentsDataV2 object containing the experiment ID, variant ID, user
token, and other assignment fields. See the
field reference for the
complete list of properties.
This snippet is the canonical placement location for the analytics callback.
Platform-specific bulkCallbackV2 implementations — including how to map
treatment fields to Segment, Amplitude, Heap, and other tools — are covered
under Analytics Integrations.
# Tracking Settings
Conversion events, tracking-only mode, and the analytics treatment callback
This page covers three tracking-related configuration options: firing
conversion events, enabling tracking-only mode, and subscribing to the
analytics treatment callback that feeds your existing analytics platform.
## Conversion Events
A conversion event tells Coframe that a visitor completed a meaningful action
— a purchase, a sign-up, a checkout step — so that the action can be counted
as a metric outcome for any active experiments.
Push a `conversion` command to `window.CFQ` at the point in your code where
the action occurs:
HTML
```
<script>
window.CFQ = window.CFQ || [];
window.CFQ.push({
conversion: {
metricName: 'purchase_completed',
value: 99.99
}
});
</script>
```
Replace `purchase_completed` with the metric name you configured for your
experiment. The `value` field is optional and can carry a numeric payload
such as revenue or quantity.
## Tracking-Only Mode
Setting `trackingOnly: true` in your SDK options puts Coframe into a
passive-observation mode. In this mode, Coframe records impressions and
conversion events but does not apply any treatment to the page. No elements
are modified and no anti-flicker behavior runs.
This mode is useful during an instrumentation phase, when you want to
validate that events are firing correctly before activating experiments, or
when you need to run Coframe on pages where visual modification is not yet
appropriate.
See [SDK Options](../docs/sdk-options.html) for the full list of
options and their defaults.
## Analytics Treatment Callback
When Coframe applies a treatment to the page, it can notify your analytics
platform so you can record the experiment assignment alongside the rest of
your event stream. Subscribe to `treatmentApplied` by pushing a
`bulkCallbackV2` handler to `window.CFQ`:
JS
```
window.CFQ = window.CFQ || [];
window.CFQ.push({
subscribe: 'treatmentApplied',
bulkCallbackV2: (treatments) => {
// TODO: Send all treatments to your analytics platform
treatments.forEach(treatment => {
console.log('[Coframe] treatment:', treatment);
});
}
});
```
The callback receives an array of treatments. Each `treatment` is a
`treatmentsDataV2` object containing the experiment ID, variant ID, user
token, and other assignment fields. See the
[field reference](../docs/experiment-assignment.html) for the
complete list of properties.
This snippet is the canonical placement location for the analytics callback.
Platform-specific `bulkCallbackV2` implementations — including how to map
treatment fields to Segment, Amplitude, Heap, and other tools — are covered
under [Analytics Integrations](../docs/segment.html).