Challenge 1
The pageview ping's payload marker.
flusher.on('hidden', () => {
sendBeaconSafe('/collect', {
type: '',
url: location.pathname,
ref: document.referrer,
});
});
Press Ctrl⌘Enter to check your answer
Fill in the missing pieces of pageviews, error reports, crash queues, and restore pings.
Challenge 1
flusher.on('hidden', () => {
sendBeaconSafe('/collect', {
type: '',
url: location.pathname,
ref: document.referrer,
});
});
Press Ctrl⌘Enter to check your answer
Challenge 2
window.addEventListener('error', (e) => {
const report = { message: e.message, stack: e.error?.stack };
navigator.sendBeacon('/errors', );
});
Press Ctrl⌘Enter to check your answer
Challenge 3
function reportCrash(payload: Crash) {
.setItem('crash-queue', JSON.stringify([...queued(), payload]));
sendBeaconSafe('/crashes', payload);
}
Press Ctrl⌘Enter to check your answer
Challenge 4
window.addEventListener('pageshow', (e) => {
if (e.persisted) track({ type: 'pageview', : 'bfcache_restore' });
});
Press Ctrl⌘Enter to check your answer
Challenge 5
export const sdk = {
track(event, data) { queue.push({ event, data }); },
() { return flusher.flush(queue.splice(0)); },
};
Press Ctrl⌘Enter to check your answer