Documentation
Onboarding guide
Get from zero to live analytics in minutes: installation, custom events, SaaS metrics, AI observability, and session replay.
Onboarding guide
Get WysLeap tracking running on your site in under 2 minutes with a simple script tag. No build process required.
Add this code to your site's <head> section. Replace your-site-id and your-api-key with the values from your WysLeap dashboard.
<script src="https://wysleap.com/telemetry.js"></script>
<script>
WysLeap.init({
siteId: 'your-site-id',
options: {
_apiKey: 'your-api-key',
trackClicks: true, // Automatically track click events
trackScroll: true, // Track scroll depth (enabled by default)
trackWebVitals: true, // Core Web Vitals from real visitors (enabled by default)
privacy: true, // Enable privacy mode (anonymize IP)
disableBeacon: false, // Use sendBeacon for better reliability
sessionReplay: {
enabled: true, // Off by default; true turns replay on
maskSensitive: true, // Auto-mask passwords, emails, credit cards
sampleRate: 0.5 // Record 50% of sessions (default: 1.0, all)
}
}
});
</script>trackClicks: Automatically track click events (default: true)trackScroll: Track scroll depth (default: true)trackWebVitals: Measure Core Web Vitals (LCP, INP, CLS, FCP, TTFB) in visitors' browsers, sent once per page view (default: true)privacy: Enable privacy mode to anonymize IP addresses (default: false)disableBeacon: Disable sendBeacon API (default: false)Session replay is off by default. Set sessionReplay.enabled: true to turn it on. It records user sessions for pixel-perfect replay (DOM snapshots, clicks, scrolls, form inputs).
sampleRate: share of sessions to record: 1.0 = all (default), 0.5 = 50%, 0.1 = 10%maskSensitive, on by default)recordMousemove, recordClick, recordScroll, recordInput, recordMediarecordElement: record only specific page sections by CSS selectorOnce initialized, you can use these methods to track custom events and page views:
WysLeap.trackPageView()Manually track a page view, for content that changes without a URL change. Route changes are tracked automatically.
WysLeap.trackPageView();WysLeap.trackEvent(name, data)Track a custom event with optional metadata.
WysLeap.trackEvent('button_click', {
buttonId: 'signup',
location: 'header'
});WysLeap.visitorIdThe current visitor's anonymous ID (read-only, available after init). It is null after WysLeap.setConsent(false).
console.log('Visitor ID:', WysLeap.visitorId);WysLeap.setConsent(granted)Record the visitor's choice. false opts them out fully: tracking stops and their stored ID is removed.
WysLeap.setConsent(false); // opt out
WysLeap.setConsent(true); // opt back inWysLeap initialized messageYour site is now tracking pageviews and user behavior. Next, learn how to track custom events.