This page is a placeholder for Phase 2.
This page documents what WILL be tested when the ListenLayer tracking script is integrated. The code examples below are commented as "future" because they represent planned functionality, not current implementation.
This page will test the fetch() API with the keepalive: true flag as an alternative to sendBeacon(). The keepalive option allows fetch requests to outlive the page, making it suitable for tracking unload events.
| Feature | sendBeacon() | fetch() with keepalive |
|---|---|---|
| Custom Headers | ❌ Limited | ✅ Full support |
| Authentication | ❌ Basic only | ✅ Full support |
| Payload Size | ⚠️ 64KB limit | ✅ Larger payloads |
| Browser Support | ✅ Excellent | ✅ Good (modern browsers) |
| Reliability | ✅ High | ✅ High (with keepalive) |
When the ListenLayer tracking script is integrated, this page will include:
// Future: Track page unload with fetch keepalivewindow.addEventListener('beforeunload', function() { const payload = { event: 'page_exit', sessionId: window._ll.sessionId, duration: Date.now() - window._ll.pageStartTime, interactions: window._ll.interactions }; fetch('/api/events', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + window._ll.token }, body: JSON.stringify(payload), keepalive: true });});