Advanced Configuration
Advanced configuration options for custom identifiers, privacy settings, sampling, and more.
Custom User Identification
Set a custom user ID to track users across sessions and devices:
// After user logs in
WysLeap.setUserId('user_12345');
// Clear on logout
WysLeap.clearUserId();Session Replay Advanced Options
WysLeap.init({
siteId: 'your-site-id',
options: {
_apiKey: 'your-api-key',
sessionReplay: {
enabled: true,
maskSensitive: true,
sampleRate: 1.0, // 0.0 - 1.0
maskAllInputs: false, // Mask all inputs (not just sensitive)
maskAllText: false, // Mask all text content
inactivityTimeout: 60000, // Pause after 60s of inactivity
maxDuration: 3600000 // Stop recording after 1 hour
}
}
});Option Descriptions:
- sampleRate: Reduce cost by recording a fraction of sessions
- maskAllInputs: Mask all input fields (even non-sensitive ones)
- maskAllText: Mask all text content on the page
- inactivityTimeout: Pause recording after N ms of no activity
- maxDuration: Stop recording after N ms to prevent large sessions
Privacy Settings
WysLeap.init({
siteId: 'your-site-id',
options: {
_apiKey: 'your-api-key',
privacy: true, // Anonymize IP addresses
respectDoNotTrack: true, // Honor DNT browser setting
cookieDomain: '.example.com', // Set custom cookie domain
cookieExpiry: 365 // Days until cookie expires
}
});Custom Properties
Add custom properties to all events for segmentation:
// Set custom properties
WysLeap.setCustomProperties({
plan: 'enterprise',
accountType: 'business',
region: 'us-west'
});
// These will be attached to all subsequent eventsSingle Page Application (SPA) Support
For React, Vue, Angular, or other SPAs, manually track page views on route changes:
// React Router example
import { useLocation } from 'react-router-dom';
function App() {
const location = useLocation();
useEffect(() => {
WysLeap.trackPageView();
}, [location.pathname]);
return <Routes>...</Routes>;
}Performance Optimization
Tips for Better Performance
- Use
sampleRateto record fewer sessions - Set
inactivityTimeoutto pause on idle - Use
disableBeacon: falsefor reliable tracking - Load WysLeap script asynchronously with
asyncattribute
Full API Reference
For complete API documentation, event schemas, and more examples:
View Full API Documentation →You're All Set!
You've completed the onboarding guide. Start tracking your users and analyzing their behavior!
Go to Analytics Dashboard