Debugging & Troubleshooting
Learn how to debug Rehearsals installation issues and troubleshoot common problems.
Debug Mode
Enable detailed console logging to diagnose issues:
// Enable debug mode
window.rhEnableDebug();
// Disable debug mode
window.rhDisableDebug();
Debug mode persists across page refreshes until explicitly disabled.
What Debug Mode Shows
- Initialization status
- Configuration validation
- Session ID and status
- Recording events
- Network requests
- Error messages
- Performance metrics
Verification Checklist
1. Script Loading
// Check if Rehearsals is loaded
if (window.rehearsals) {
console.log('✅ Rehearsals loaded');
console.log('Version:', window.rehearsals.version);
console.log('Session ID:', window.rehearsals.sessionId);
} else {
console.log('❌ Rehearsals not loaded');
}
2. Configuration Check
// Verify configuration
console.log('Config:', window.deepPredictionSettings);
// Should output:
// {
// apiKey: 'dp_proj_xxxxx',
// organizationId: 'dp_org_xxxxx',
// ...other settings
// }
3. Network Requests
Open Network tab in Developer Tools and look for:
recorder.js
- Should load with 200 statussession
requests - Should see periodic session data uploads
Common Issues & Solutions
Sessions Not Appearing
Problem: No sessions showing in dashboard
Solutions:
- Verify API credentials are correct
- Check browser console for errors
- Ensure script is in
<head>
section - Clear browser cache
- Check if ad blockers are interfering
// Test connection manually
fetch('https://api.runrehearsals.com/v1/health', {
headers: {
'X-API-Key': 'your_api_key'
}
}).then(res => {
console.log('API Status:', res.status);
});
Script Not Loading
Problem: recorder.js
fails to load
Solutions:
<!-- Check script placement - should be in <head> -->
<head>
<script>
window.deepPredictionSettings = {...};
</script>
<script src="https://app.runrehearsals.com/recorder.js" async></script>
</head>
<!-- Not in body or footer -->
Cross-Domain Issues
Problem: Sessions not linking across subdomains
Solution: Set cookie domain correctly
window.deepPredictionSettings = {
apiKey: 'dp_proj_xxxxx',
organizationId: 'dp_org_xxxxx',
cookieDomain: '.example.com' // Note the leading dot
};
Content Security Policy Errors
Problem: CSP blocking Rehearsals
Solution: Update your CSP headers
Content-Security-Policy:
script-src 'self' https://app.runrehearsals.com;
connect-src 'self' https://api.runrehearsals.com;
Single Page Application Issues
Problem: Navigation not tracked in SPA
Solution: Rehearsals auto-detects SPAs, but you can manually trigger:
// Manual page view tracking
window.rehearsals?.trackPageView({
url: window.location.href,
title: document.title
});
// React Router example
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
function useRehearsalsTracking() {
const location = useLocation();
useEffect(() => {
window.rehearsals?.trackPageView();
}, [location]);
}
Browser-Specific Issues
Safari/iOS
Issue: Intelligent Tracking Prevention (ITP)
// Use first-party cookie domain
window.deepPredictionSettings = {
...settings,
cookieDomain: window.location.hostname,
useFirstPartyCookies: true
};
Chrome Extensions
Some extensions may interfere. Test in incognito mode:
// Detect extension interference
if (window.rehearsals === undefined && !window.location.href.includes('chrome-extension://')) {
console.warn('Rehearsals may be blocked by an extension');
}
Performance Issues
High Memory Usage
// Reduce recording frequency
window.deepPredictionSettings = {
...settings,
throttle: 100, // Milliseconds between captures
compressEvents: true,
sampleRate: 0.5 // Record 50% of sessions
};
Large DOM Sites
// Optimize for complex DOMs
window.deepPredictionSettings = {
...settings,
simplifyDOM: true,
maxDOMDepth: 10,
skipHeavyElements: true
};
Testing Tools
Session Simulator
// Simulate user activity for testing
function simulateActivity() {
// Click random elements
const elements = document.querySelectorAll('button, a, input');
const randomEl = elements[Math.floor(Math.random() * elements.length)];
randomEl?.click();
// Scroll randomly
window.scrollBy(0, Math.random() * 100);
// Repeat
setTimeout(simulateActivity, 2000);
}
// Start simulation
simulateActivity();
Health Check
// Comprehensive health check
function checkRehearsals() {
const checks = {
loaded: !!window.rehearsals,
configured: !!window.deepPredictionSettings,
hasApiKey: !!window.deepPredictionSettings?.apiKey,
hasOrgId: !!window.deepPredictionSettings?.organizationId,
sessionActive: !!window.rehearsals?.sessionId,
recording: window.rehearsals?.isRecording?.()
};
console.table(checks);
return checks;
}
checkRehearsals();
Error Reference
Common Error Messages
Error | Meaning | Solution |
---|---|---|
Invalid API key |
API key format incorrect | Check key starts with dp_proj_ |
Organization not found |
Org ID incorrect | Verify org ID in dashboard |
Rate limit exceeded |
Too many requests | Implement sampling or upgrade plan |
Session quota reached |
Monthly limit hit | Upgrade plan or wait for reset |
CORS blocked |
Cross-origin issue | Check domain whitelist in dashboard |
Getting Help
Before Contacting Support
- Enable debug mode and collect logs
- Check browser console for errors
- Test in different browser/incognito
- Review this troubleshooting guide
- Check status page
Contact Support
Include this information:
- Your organization ID
- Browser and version
- Website URL
- Console error messages
- Steps to reproduce issue
📧 Email: support@runrehearsals.com 💬 Chat: Available in your dashboard