Integrate Convert Experiences with Heap Analytics
Track Convert Experiment Data in Heap Analytics for Deeper Insights
THIS ARTICLE WILL HELP YOU:
- Convert-Heap Analytics Integration
- Add Tracking Code Snippets
- Activate Integration in Convert
- Activate Integration Manually
- View Convert Data in Heap Analytics
Convert-Heap Analytics Integration
Integration of Heap Analytics with Convert Experiences will help you to import Convert data into your Heap Analytics account.
For each experiment, the integration uses variables and events to pass along the experiment name and variation name that the visitor is currently bucketed into (if any).
Add Tracking Code Snippets
Make sure the Convert tracking code and the Heap Analytics code are installed on your page.

Activate Integration in Convert
Go to your Convert experience settings and under Integrations select the Heap Analytics. Then click Save and Continue. Once activated, Heap will automatically capture all active experiments and exposed variation as a property on all events for a given page.

Activate Integration Manually
If you do not want to activate the integration through the Convert interface, you can send custom events yourself. Add this code to Project > Configuration > Global Project Javascript. It waits until Convert has evaluated the experiences on the page and Heap has loaded, then sends one event for each experience the visitor is in. When data anonymization is on in your project, it sends the experience and variation IDs instead of the names.
This code works with the current Convert tracking script. If your project still uses the Legacy tracking script, move to the current script first. For more on the window.convert object, see The window.convert Object in the developer docs.
window._conv_q = window._conv_q || [];
window._conv_q.push({
what: 'addListener',
params: {
event: 'snippet.goals_evaluated',
handler: function () {
var rows = getConvertData();
whenReady(function () { return window.heap && heap.track; }, function () {
rows.forEach(function (row) {
heap.track('Convert Experiences', {
Exp_Name: row.experienceName,
Var_Name: row.variationName
});
});
});
}
}
});
// Returns the experiences the visitor is in on this page, with their variation.
// With data anonymization on, it uses IDs instead of names.
function getConvertData() {
var rows = [];
var current = convert.currentData.experiences || {};
var configured = convert.data.experiences || [];
var settings = convert.data.project && convert.data.project.settings;
var anonymize = !!(settings && settings.data_anonymization);
for (var experienceId in current) {
if (!current.hasOwnProperty(experienceId)) continue;
var variation = current[experienceId].variation || {};
var experience = configured.filter(function (e) {
return String(e.id) === String(experienceId);
})[0];
rows.push({
experienceId: experienceId,
variationId: String(variation.id),
experienceName: anonymize ? experienceId : (experience ? experience.name : experienceId),
variationName: anonymize ? String(variation.id) : variation.name
});
}
return rows;
}
// Waits up to 10 seconds for the tool's code to load, then sends the data.
function whenReady(isReady, send) {
var tries = 0;
(function check() {
if (isReady()) return send();
if (tries++ < 50) setTimeout(check, 200);
})();
}
View Convert Data in Heap Analytics
Using a Custom Event in Heap Analytics, you will be able to view all of your Convert Experiences data as they associate to the values that you pass in the event.
When you log in to your Heap Analytics account, you should go to Organize - Events - Custom Events and find the one for Convert Experiences.
