Enhance A/B Testing with Convert & Quantum Metric for Advanced Session Replays and User Insights
This Article Will Help You:
Convert-Quantum Metric Integration
Convert Experiences can integrate with Quantum Metric to provide powerful session replay capabilities and analytics for your A/B testing experiments. This integration allows you to segment session replays by experiment variations, helping you understand user behavior in each test variant.
For each experiment, the integration passes the experiment name and variation name to Quantum Metric, allowing you to filter and analyze sessions based on specific test conditions.
Set Up Quantum Metric on Your Website
-
Sign up for Quantum Metric through your account representative or their website.
-
Follow Quantum Metric's implementation instructions to add their JavaScript tracking code to your website.
-
Verify that Quantum Metric is properly tracking sessions on your site through their dashboard.
The Quantum Metric JavaScript needs to be implemented before the integration code can function properly. After adding this code, Quantum Metric will begin collecting user interaction data across your website.
Implement the Integration Code
Make sure both the Convert tracking code and the Quantum Metric tracking code are installed on your page. Then, add the following integration code in Your Convert Project > Configuration > Global Project JS section.
// Function to handle sending data to Quantum Metric
function sendDataToQuantumMetric(data) {
(window.requestIdleCallback || window.setTimeout)(function() {
if (!window.QuantumMetricAPI) {
return;
}
data.forEach(item => {
if (typeof window.QuantumMetricAPI.logEvent === 'function') {
window.QuantumMetricAPI.logEvent('convert_test', {
experimentName: item.expName,
variationName: item.varName
});
} else if (window.QuantumMetric && typeof window.QuantumMetric.sendEvent === 'function') {
window.QuantumMetric.sendEvent('convert_test', {
experimentName: item.expName,
variationName: item.varName
});
}
});
}, { timeout: 1000 });
}
// Function to check if Quantum Metric is loaded, with reduced polling frequency
function whenQuantumMetricAvailable(callback) {
if (window.QuantumMetricAPI) {
callback();
return;
}
const maxTime = 150 * 1000;
const interval = 250;
let elapsedTime = 0;
var intervalId = setInterval(function() {
if (window.QuantumMetricAPI) {
clearInterval(intervalId);
setTimeout(callback, 0);
} else if (elapsedTime > maxTime) {
clearInterval(intervalId);
}
elapsedTime += interval;
}, interval);
}
// Flag to track if experiences_evaluated has completed
let experiencesEvaluationComplete = false;
// Convert snippet lifecycle hook for experiences evaluated
window._conv_q = window._conv_q || [];
window._conv_q.push({
what: 'addListener',
params: {
event: 'snippet.experiences_evaluated',
handler: () => {
setTimeout(function() {
if (!convert.currentData || !convert.currentData.experiences ||
Object.keys(convert.currentData.experiences).length === 0) {
experiencesEvaluationComplete = true;
return;
}
const allData = [];
const processChunk = function(keys, index) {
const chunkSize = 5;
const chunk = keys.slice(index, index + chunkSize);
if (chunk.length === 0) {
if (allData.length > 0) {
whenQuantumMetricAvailable(function() {
sendDataToQuantumMetric(allData);
experiencesEvaluationComplete = true;
});
} else {
experiencesEvaluationComplete = true;
}
return;
}
chunk.forEach(expId => {
const expData = convert.currentData.experiences[expId];
const variation = expData.variation;
let experimentName = '';
for (let i = 0; i < convert.data.experiences.length; i++) {
if (convert.data.experiences[i].id === expId) {
experimentName = convert.data.experiences[i].name;
break;
}
}
if (!experimentName) {
experimentName = 'Unknown Experiment';
}
allData.push({ expName: experimentName, varName: variation.name });
});
setTimeout(function() {
processChunk(keys, index + chunkSize);
}, 0);
};
processChunk(Object.keys(convert.currentData.experiences), 0);
}, 0);
}
}
});
Implementation Notes:
-
Add this code to Your Convert Project > Configuration > Global Project JS section.
-
The integration will only send data when actual experiments are running and users are assigned to variations.
-
The code checks for the availability of Quantum Metric before attempting to send any data.
View Convert Data in Quantum Metric Dashboard
Once the integration is in place, you can use Quantum Metric's segmentation capabilities to filter session replays and analyze data based on Convert experiments:
-
Create Segments: In the Quantum Metric dashboard, create segments filtered by the custom event
'convert_test'
with specific experiment names or variation names. -
Filter Session Replays: Use these segments to watch session recordings of users who experienced specific variations of your experiments.
-
Analyze Behavior: Combine Quantum Metric's analytics with Convert's experiment data to gain deeper insights into user behavior within each variation.
-
Create Custom Metrics: Build custom metrics in Quantum Metric based on Convert experiment data to track performance across different test variations.
This integration helps you understand not just what is happening in your experiments (which Convert already tells you), but also why certain variations perform better by showing you actual user behaviors through session replays.
Troubleshooting
-
No Data in Quantum Metric: Verify that both Convert and Quantum Metric scripts are loading properly. Check the browser console for any error messages.
-
Missing Experiment Data: Ensure that the integration code is added after both the Convert and Quantum Metric scripts, and that it's being executed after experiments are evaluated.
-
API Method Errors: If you see errors about missing methods, consult with your Quantum Metric representative about the correct API methods for your specific implementation.
For additional assistance, contact Convert support at support@convert.com or your Quantum Metric Customer Success representative.