StatSig Integration
StatSig is a feature flagging and experimentation platform that provides A/B testing, feature flags, and advanced analytics for product teams.
Environment Variables
Required Client Variables
NEXT_PUBLIC_STATSIG_CLIENT_KEY=client-... # Your StatSig client SDK key
Setup Instructions
-
Create a StatSig Account: Sign up at statsig.com if you haven't already
-
Get Your Client SDK Key:
- Go to your StatSig Console
- Navigate to "Project Settings" → "Keys & Environments"
- Copy your "Client SDK Key" (starts with
client-)
-
Add Environment Variables:
NEXT_PUBLIC_STATSIG_CLIENT_KEY=your_client_sdk_key_here
Features Enabled
When this environment variable is configured, the following features become available:
- ✅ Feature flag management
- ✅ A/B testing and experimentation
- ✅ User segmentation and targeting
- ✅ Real-time feature rollouts
- ✅ Performance monitoring
- ✅ User behavior analytics
- ✅ Dynamic configuration
Configuration Options
Advanced Configuration
You can customize StatSig behavior with additional environment variables:
# StatSig API endpoint (usually default)
NEXT_PUBLIC_STATSIG_API_URL=https://api.statsig.com/v1
# Enable debug mode in development
NEXT_PUBLIC_STATSIG_DEBUG=true
# Custom user ID generation
NEXT_PUBLIC_STATSIG_USER_ID_TYPE=uuid
Testing
StatSig provides comprehensive testing capabilities:
- Test feature flags in different environments
- Create test experiments with specific user segments
- Use the StatSig debug view for troubleshooting
- Monitor experiment results in real-time
Production Deployment
Before going live:
- Ensure proper user identification strategy
- Configure appropriate user segments
- Set up proper experiment monitoring
- Review data collection and privacy policies
- Configure feature flag rollout strategies
- Set up proper error handling for flag evaluation