Overview
Constructor.io supports two types of user-level customization:- Segments - Named user groups for personalization (e.g., “VIP”, “mobile_user”, “returning_customer”)
- Test Cells - A/B test variant assignments (e.g.,
{"search_algorithm": "variant_b"})
User Segments
Segments are array of strings that categorize users into groups. Constructor.io uses segments to:- Personalize search results and recommendations
- Filter and boost products for specific user groups
- Segment analytics and reports
- Enable targeted merchandising campaigns
Setting Segments
Define segments during client initialization:Common Segment Examples
Customer Tier Segments
Customer Tier Segments
Differentiate experiences by customer value:
Device and Platform Segments
Device and Platform Segments
Optimize experiences by device:
Behavioral Segments
Behavioral Segments
Target users by behavior patterns:
Geographic Segments
Geographic Segments
Personalize by location:
Demographic Segments
Demographic Segments
Target specific demographics:
Dynamic Segment Assignment
Segments can be determined dynamically based on user data:Updating Segments at Runtime
Change segments for a user session usingsetClientOptions:
How Segments Affect Results
When segments are set, Constructor.io includes them in all API requests as theus parameter:
- Boost or bury products for specific segments
- Create segment-specific merchandising rules
- Filter products by segment availability
- Analyze performance by segment
Test Cells
Test cells assign users to A/B test variants. Each test cell is a key-value pair where:- Key - The experiment name (e.g.,
"search_algorithm") - Value - The variant assigned to the user (e.g.,
"variant_b")
Setting Test Cells
Define test cells during client initialization:Test Cell Validation
The SDK automatically validates test cells usinghelpers.toValidTestCells(). Invalid entries are filtered out:
Common Test Cell Examples
Search Algorithm Tests
Search Algorithm Tests
Test different ranking algorithms:
UI/UX Tests
UI/UX Tests
Test interface variations:
Recommendation Strategy Tests
Recommendation Strategy Tests
Test recommendation approaches:
Merchandising Tests
Merchandising Tests
Test merchandising tactics:
Test Cell Assignment
Typically, you’ll use an A/B testing platform to assign variants, then pass them to Constructor.io:Updating Test Cells at Runtime
Modify test cell assignments usingsetClientOptions:
How Test Cells Affect Results
Test cells are sent with every Constructor.io request asef-{key} parameters:
- Configure experiment-specific ranking rules
- Analyze experiment performance
- Compare conversion rates across variants
- Determine winning variants
Combining Segments and Test Cells
Use both segments and test cells together for advanced personalization:- Personalizes results for VIP mobile users who are returning customers
- Applies experiment variant
variant_bfor search ranking - Uses personalized recommendation strategy
- Shows control UI layout
Best Practices
1. Use Meaningful Segment Names
Choose descriptive, consistent segment names:2. Limit the Number of Segments
Avoid creating too many granular segments:3. Keep Test Cell Keys Descriptive
Use experiment names that describe what’s being tested:4. Document Segment and Test Cell Usage
Maintain documentation for your segments and test cells:5. Update Segments When User State Changes
Ensure segments reflect current user state:6. Validate Test Cell Values
Ensure test cell values are strings:Server-Side Usage
Segments and test cells work identically in server-side (Node.js) environments:Analytics and Reporting
Segments and test cells appear in Constructor.io analytics, allowing you to:- Compare search performance across segments
- Measure conversion rates by segment
- Analyze A/B test results
- Identify high-performing user cohorts
- Optimize merchandising by segment
Troubleshooting
Segments not appearing in analytics
Segments not appearing in analytics
- Verify segments are set during client initialization
- Check that
sendTrackingEvents: trueis enabled - Ensure segment names match those configured in Constructor.io dashboard
- Look for segments in request URLs as
usparameters
Test cells not affecting results
Test cells not affecting results
- Confirm test cells are configured in Constructor.io dashboard
- Check request URLs for
ef-{key}={value}parameters - Verify test cell values are strings (not null/undefined)
- Ensure experiment is active in Constructor.io
Segments not updating after setClientOptions
Segments not updating after setClientOptions
- Verify
setClientOptionsis called with new segments - Check that subsequent requests include updated segments
- Ensure you’re not creating a new client instance (reuse the same instance)