Reading Triggered Experiment Data for Using it in Third Party Systems
Read & Sync Convert Experiment Data to External Platforms
| Author: | George F. Crewe |
THIS ARTICLE WILL HELP YOU:
- Give an Overview of convert.currentData and convert.historicalData
- Understand Latest Object Structures
- Access Data Safely with _conv_q
- Know Difference with Legacy Structure
This guide explains how to access live and historical Convert experiment data (convert.currentData and convert.historicalData) from the web script for integration with third-party analytics and tracking systems.
The latest Convert web script significantly restructured the experiment objects for greater detail and clarity, moving away from simple variation ID/name pairings to a comprehensive nested variation object.
1. Latest Object Structures
Convert provides two main global JavaScript objects for accessing experiment data: convert.currentData and convert.historicalData.
convert.currentData
This object holds the data for all experiments and goals that were triggered on the current page load.
|
Key |
Description |
|
experiences |
(New) This object contains all experiments currently running on the page. Keys are Experience IDs. |
|
goals |
A map of goals triggered on the current page. Keys are Goal IDs and values are always 1. |
|
experiencesGoals |
(New) Contains goal data structured relative to experiences, mirroring the data in goals. |
Details of the experiences Object
Each experience object (e.g., experiences["100127238"]) contains the following structure:
|
Key |
Description |
|
firstTime |
A Boolean indicating if the experiment is being triggered for the first time for this visitor on this page. (Previously first_time). |
|
variation |
(New) A nested object containing all variation details. |
Details of the nested variation Object
|
Key |
Description |
|
id |
The ID of the variation presented to the visitor. |
|
name |
The name of the variation. |
|
key |
A unique key combining the variation ID and name/type. |
|
status |
The current status of the variation (e.g., "running"). |
|
traffic_allocation |
The percentage of traffic allocated to this variation. |
|
changes |
An array of change objects, providing detail on the visual/code changes applied. |
Example of convert.currentData (Latest)
{
"experiences": {
"100127238": {
"firstTime": false,
"variation": {
"changes": [
{
"name": "Original"
}
],
"id": "1001186426",
"name": "Original",
"key": "1001186426-original",
"status": "running",
"traffic_allocation": 50
}
}
/* ... other experiences ... */
},
"experiencesGoals": {},
"goals": {}
}
convert.historicalData
This object contains experiment data gathered across all past visitor sessions, showing all experiments that have ever been triggered for the visitor.
|
Key |
Description |
|
experiences |
(New) This object contains all experiments previously triggered for the visitor. Keys are Experience IDs. |
Details of the experiences Object
Each experience object (e.g., experiences["100127238"]) contains:
|
Key |
Description |
|
variationId / variation_id |
The ID of the variation the visitor was bucketed into for this experiment. |
|
variationName / variation_name |
The name of the variation. |
|
goals |
An object holding goals triggered for the current experiment. Keys are Goal IDs and values are the count of conversions. |
Example of convert.historicalData (Latest)
{
"experiences": {
"100127238": {
"variation_name": "Original",
"variationName": "Original",
"variation_id": 1001186426,
"variationId": 1001186426,
"goals": {
"100132206": 1,
"100132207": 1
}
}
/* ... other experiences ... */
}
}
2. Accessing Data Safely using _conv_q
Since parts of the Convert tracking script may execute asynchronously, it is essential to ensure that experiment data is fully loaded and available before trying to access it. Use the Convert queue variable, _conv_q, to safely execute your integration script.
_conv_q = _conv_q || [];
_conv_q.push([function(){
// Your script that handles the data here
// Example: Loop through running experiences and send to a third-party system
if (convert.currentData && convert.currentData.experiences) {
for (const expId in convert.currentData.experiences) {
const experience = convert.currentData.experiences[expId];
const variationName = experience.variation.name;
const variationId = experience.variation.id;
// ... push data to external system ...
console.log(`User is in Experience ${expId}, Variation: ${variationName} (${variationId})`);
}
}
}]);
3. Note on Legacy Object Structure
The legacy (older) Convert web script objects primarily used the top-level keys experiments instead of the new experiences.
The main difference was in the structure of convert.currentData.experiments:
- Legacy structure: Variation data was flattened, residing directly within the experiment object, including variationId, variationName, and first_time.
- Crucially, for detail, it included a separate object called variation_name_parts, which housed the changes array and sections array (primarily used for Multivariate Tests) instead of nesting everything under a comprehensive variation object.
- Example Legacy Access: convert.currentData.experiments[expId].variationId and convert.currentData.experiments[expId].variation_name_parts.changes.
The new script simplifies data access by organizing all variation-related attributes under a single, dedicated variation object.