Segment
Send Shoplift test data to Segment to unify your A/B testing insights with your entire customer data platform and all connected destinations.
Quick Start
// Segment + Shoplift Integration
function initializeShopliftSegment() {
if (window.shoplift && window.analytics) {
const visitorData = window.shoplift.getVisitorData();
if (visitorData.visitor && visitorData.visitorTests.length > 0) {
// Track test exposures
visitorData.visitorTests.forEach(test => {
analytics.track('Experiment Viewed', {
experiment_id: test.testId,
variant_id: test.hypothesisId,
is_theme_test: test.isThemeTest
});
});
// Identify user with test data
const traits = {
shoplift_visitor_id: visitorData.visitor.id,
shoplift_device: visitorData.visitor.device,
shoplift_country: visitorData.visitor.country
};
// Add each test as a trait
visitorData.visitorTests.forEach(test => {
traits[`shoplift_test_${test.testId}`] = test.hypothesisId;
});
analytics.identify(visitorData.visitor.id, traits);
}
} else {
setTimeout(initializeShopliftSegment, 100);
}
}
// Initialize on page load
initializeShopliftSegment();
Implementation Details
Track Calls
The integration sends an Experiment Viewed
event for each test assignment, following Segment's standard naming convention for A/B testing events.
Identify Calls
User traits are set with test participation data, allowing you to:
Create user segments based on test exposure
Trigger personalized campaigns in connected tools
Build cohorts for analysis in downstream destinations
Event Properties Reference
experiment_id
String
Unique test identifier from Shoplift
variant_id
String
Specific hypothesis/variant ID
is_theme_test
Boolean
Whether this is a theme test
Last updated
Was this helpful?