WysLeap
Documentation

Onboarding Guide

Get from zero to live analytics in minutes — installation, custom events, SaaS metrics, AI observability, and session replay.

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:

html
// After user logs in
WysLeap.setUserId('user_12345');

// Clear on logout
WysLeap.clearUserId();

Session Replay Advanced Options

html
WysLeap.init({
  siteId: 'your-site-id',
  options: {
    _apiKey: 'your-api-key',
    sessionReplay: {
      enabled: true,
      maskSensitive: true,
      sampleRate: 0.5,              // 0.0 - 1.0 (default: 0.5)

      // Privacy
      maskAllInputs: false,         // Mask all inputs (not just sensitive)
      maskAllText: false,           // Mask all text content

      // Session limits
      inactivityTimeout: 60000,     // Pause after 60s of inactivity
      maxInactivityTimeout: 900000, // Stop completely after 15min idle
      maxSessionDuration: 900000,   // Max recording length (15min)
      stopOnHidden: true,           // Stop when tab goes to background

      // Recording controls
      recordMousemove: false,       // Mouse movement (off by default)
      recordClick: true,            // Click events
      recordScroll: true,           // Scroll events
      recordInput: true,            // Form input changes
      recordMedia: true,            // Media element events

      // Element-level filter (optional)
      recordElement: null           // e.g. ['#checkout', '.hero']
    }
  }
});

Option Descriptions:

  • sampleRate: Reduce cost by recording a fraction of sessions (0.0 to 1.0)
  • 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
  • maxInactivityTimeout: Stop recording completely after N ms of extended inactivity
  • maxSessionDuration: Stop recording after N ms to prevent large sessions
  • stopOnHidden: Stop recording when the browser tab goes to background
  • recordMousemove: Toggle mouse movement recording (off by default — saves ~60-70% of event data)
  • recordClick: Toggle click event recording
  • recordScroll: Toggle scroll event recording
  • recordInput: Toggle form input change recording
  • recordMedia: Toggle media element event recording
  • recordElement: Array of CSS selectors — only record DOM changes inside these elements

Privacy Settings

html
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:

html
// Set custom properties
WysLeap.setCustomProperties({
  plan: 'enterprise',
  accountType: 'business',
  region: 'us-west'
});

// These will be attached to all subsequent events

Single Page Application (SPA) Support

For React, Vue, Angular, or other SPAs, manually track page views on route changes:

html
// 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 sampleRate to record fewer sessions
  • Keep recordMousemove: false (default) — saves ~60-70% of event data
  • Use recordElement to record only specific page sections
  • Set inactivityTimeout to pause on idle
  • Load WysLeap script asynchronously with async attribute

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