Heap
Track Shoplift test variants in Heap to leverage automatic event capture and retroactive analysis capabilities.
Quick Start
Add this code after your Heap snippet:
// Heap + Shoplift Integration
function initializeShopliftHeap() {
if (window.shoplift && window.heap) {
const visitorData = window.shoplift.getVisitorData();
if (visitorData.visitor && visitorData.visitorTests.length > 0) {
// Identify user with Shoplift visitor ID
heap.identify(visitorData.visitor.id);
// Add user properties
const properties = {
shoplift_visitor_id: visitorData.visitor.id,
shoplift_device: visitorData.visitor.device,
shoplift_country: visitorData.visitor.country,
shoplift_first_seen: visitorData.visitor.createdAt
};
// Add test assignments as properties
visitorData.visitorTests.forEach(test => {
properties[`test_${test.testId}`] = test.hypothesisId;
properties[`test_${test.testId}_type`] = test.isThemeTest ? 'theme' : 'element';
properties[`test_${test.testId}_assigned`] = test.createdAt;
});
heap.addUserProperties(properties);
// Track test exposure events
visitorData.visitorTests.forEach(test => {
heap.track('Shoplift Test Exposure', {
test_id: test.testId,
variant_id: test.hypothesisId,
is_theme_test: test.isThemeTest
});
});
}
} else {
setTimeout(initializeShopliftHeap, 100);
}
}
// Initialize on page load
initializeShopliftHeap();
Retroactive Analysis
Heap's automatic event capture means you can:
Define Events After the Fact
Create new events in Heap's UI and immediately analyze them by test variant without requiring code changes.
Build Test-Specific Funnels
Go to Analyze > Funnels
Add your conversion steps
Filter by
test_[test_id]
propertyCompare conversion rates across variants
Create Variant Cohorts
Navigate to Users > Segments
Create segments based on test properties
Analyze long-term behavior differences
Visual Labeling
Use Heap's visual labeling to:
Tag elements involved in your tests
Create events specific to test interactions
Track engagement with variant-specific elements
Best Practices
Use consistent property naming (
test_
prefix for all test properties)Include assignment timestamps to analyze time-based effects
Track both automatic and manual allocation tests
Create saved reports for each major test
Export data via API for custom analysis
Last updated
Was this helpful?