With the Convert-Piano integration, unique visitors to your experiments’ variations will be passed into Piano using custom events.
Piano Analytics (formerly AT Internet) is a powerful, privacy-friendly analytics service that serves as an attractive alternative to other platforms. With the Convert Experiences and Piano Analytics integration, unique visitors bucketed into your experiments’ variations will be passed into Piano Analytics using custom events, allowing for detailed segmentation and analysis of your A/B test results within your analytics platform.
Instructions of the integration:
// Function to handle the data sending to Piano Analytics
function sendDataToPianoAnalytics(data) {
// Check if the Piano Analytics tracker (pa) and the sendEvent method exist
if (typeof pa !== 'undefined' && typeof pa.sendEvent === 'function') {
data.forEach(item => {
pa.sendEvent('Convert Experiences', {
Exp_Name: item.expName,
Var_Name: item.varName
});
// console.log("Sent data to Piano Analytics: Exp_Name =", item.expName, "Var_Name =", item.varName);
});
} else {
console.error("Piano Analytics (pa.sendEvent) function is not available.");
}
}
// Function to check if a library (e.g., pa for Piano Analytics) is loaded, with a timeout
function whenAvailable(name, callback) {
const maxTime = 5000; // Maximum time to wait in milliseconds (5 seconds)
const interval = 100; // Poll every 100 milliseconds
let elapsedTime = 0; // Track the elapsed time
var intervalId = setInterval(function() {
if (window[name]) {
clearInterval(intervalId);
callback();
} else if (elapsedTime > maxTime) {
clearInterval(intervalId);
console.error(name + " library did not load in time.");
}
elapsedTime += interval;
}, interval);
}
// 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: () => {
// Prepare the data for each experiment and variation
const allData = Object.keys(convert.currentData.experiments || {}).map(expId => {
const experimentData = convert.currentData.experiments[expId];
// Access the experiment details from the general data object
const experimentRefData = window.convert.data.experiments;
// 1. Get the Experiment Name
var expName = experimentRefData[expId] && experimentRefData[expId].n
? experimentRefData[expId].n
: "unknown experiment name";
// Clean up common prefixes from the name
expName = expName.replace("Test #", "Test ");
// 2. Get the Variation Name
var varName = experimentData.variation_name
? experimentData.variation_name
: "unknown variant";
// Clean up common prefixes from the name
varName = varName.replace("Var #", "Variation ");
return {
expName: expName,
varName: varName
};
});
// Wait for the Piano Analytics library (pa) to be available
whenAvailable('pa', function() {
// Once 'pa' is available, process and send data
sendDataToPianoAnalytics(allData);
});
}
}
});
Once the integration is enabled, you will be able to view all of your Convert Experiences data as they are associated with the custom event name: Convert Experiences. The experiment name and variation name will be passed as custom properties within this event, enabling advanced post-segmentation.