WysLeap
WysLeap Docs

Advanced Configuration

Advanced configuration options for visitor identity, privacy settings, sampling, and more.

Visitor Identity

WysLeap identifies visitors with an anonymous ID stored in the browser (WysLeap.visitorId). There is no API to attach your own user IDs, and visitors aren't linked across devices. To analyze by account or plan, pass those values as properties on your events (see Custom Properties).

Session Replay Advanced Options

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

      // 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

OptionWhat it does
sampleRateReduce cost by recording a fraction of sessions (0.0 to 1.0)
maskSensitiveOn by default. Masks every input field and the text of elements marked data-sensitive, data-private or class="sensitive". Add class="rr-block" to leave an element out of recordings entirely.
inactivityTimeoutPause recording after N ms of no activity
maxInactivityTimeoutStop recording completely after N ms of extended inactivity
maxSessionDurationStop recording after N ms to prevent large sessions
stopOnHiddenStop recording when the browser tab goes to background
recordMousemoveToggle mouse movement recording (off by default, since mouse movement is typically the largest share of event data)
recordClickToggle click event recording
recordScrollToggle scroll event recording
recordInputToggle form input change recording
recordMediaToggle media element event recording
recordElementArray of CSS selectors. Only record DOM changes inside these elements

Privacy Settings

WysLeap.init({
  siteId: 'your-site-id',
  options: {
    _apiKey: 'your-api-key',
    privacy: true               // Ask the server to anonymize IP addresses
  }
});

WysLeap sets no cookies, so there are no cookie options. To let a visitor opt out, call WysLeap.setConsent(false).

Custom Properties

Pass the properties you want to segment by with each event:

WysLeap.trackEvent('report_exported', {
  plan: 'enterprise',
  accountType: 'business',
  region: 'us-west'
});

Single Page Application (SPA) Support

Page views in React, Vue, Angular and other SPAs are tracked automatically: the tracker records each route change (pushState, back/forward and hash changes) once, with the new page's title. No extra code is needed.

Call WysLeap.trackPageView() only if your app changes pages without changing the URL. Calling it on route changes as well is harmless: a second page view for the same URL within two seconds is ignored.

// Only for pages that change without a URL change
WysLeap.trackPageView();

WysLeap sets no cookies. It keeps one random, anonymous visitor ID in the browser's local storage and anonymizes IP addresses. Device recognition is being tested in a measurement-only mode: it reads device characteristics to measure how well visitors who clear their storage could be recognized, and it is not used to identify anyone.

For visitors in the EU/EEA, UK and Switzerland, WysLeap stores and sends nothing (no visitor ID, page views, events or session replay) until you record their consent. Tell WysLeap when a visitor accepts or declines, for example from your consent banner's callback. Session replay never runs for visitors with Global Privacy Control enabled.

// Visitor accepted analytics / device recognition
WysLeap.setConsent(true);

// Visitor declined or withdrew consent: full opt-out. WysLeap stops
// tracking this browser (page views, events, replays, device
// recognition), removes the stored visitor ID, forgets its
// device-recognition links, and stays off on later visits until
// setConsent(true) is called.
WysLeap.setConsent(false);

To require consent from every visitor, choose Only with consent under Device recognition in your site settings, or pass requireConsent: true. To turn device recognition off entirely, pass fingerprinting: false or choose Off in site settings. Visitors with Global Privacy Control or Do Not Track enabled are always skipped.

Your jurisdiction and how you use analytics decide whether you need a consent banner. Check with your privacy advisor, and mention WysLeap in your privacy policy.

Performance Optimization

Tips for Better Performance

  • Use sampleRate to record fewer sessions
  • Keep recordMousemove: false (default). Mouse movement is typically the largest share 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 setup guides. Start tracking your users and analyzing their behavior!

Go to Analytics Dashboard →