Installation
Get WysLeap tracking running on your site in under 2 minutes with a simple script tag. No build process required.
Step 1: Add the Tracking Script
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)
privacy: true, // Enable privacy mode (anonymize IP)
disableBeacon: false, // Use sendBeacon for better reliability
sessionReplay: {
enabled: true, // Session replay enabled by default
maskSensitive: true, // Auto-mask passwords, emails, credit cards
sampleRate: 1.0 // Record 100% of sessions (default)
}
}
});
</script>Configuration Options
Basic Options
trackClicks– Automatically track click events(default: true)trackScroll– Track scroll depth(default: true)privacy– Enable privacy mode to anonymize IP addresses(default: true)disableBeacon– Disable sendBeacon API(default: false)
Session Replay
Session replay is enabled by default and records user sessions for pixel-perfect replay (DOM snapshots, mouse movements, clicks, scrolls, form inputs).
sampleRate: 1.0– 100% of sessions (default);0.5= 50%,0.1= 10%- Passwords, emails, and credit card inputs are automatically masked
- Event-based recording (not video) for smaller data footprint; GDPR compliant
SDK Methods
Once initialized, you can use these methods to track custom events and page views:
Manually track a page view (e.g., after SPA navigation).
WysLeap.trackPageView();Track a custom event with optional metadata.
WysLeap.trackEvent('button_click', {
buttonId: 'signup',
location: 'header'
});Get the current visitor's unique ID.
const visitorId = WysLeap.getVisitorId();
console.log('Visitor ID:', visitorId);Verify Installation
How to Confirm It's Working
- Open your browser's Developer Console (F12)
- Look for
WysLeap initializedmessage - Visit your Analytics Dashboard
- Check for real-time visitor data (may take 10-30 seconds to appear)
Installation Complete!
Your site is now tracking pageviews and user behavior. Next, learn how to track custom events.
Next: Custom Events