Skip to content

Instantly share code, notes, and snippets.

@omrilotan
Created April 5, 2020 14:06
Show Gist options
  • Save omrilotan/d059561eb043312409a64e0b97b986a5 to your computer and use it in GitHub Desktop.
Save omrilotan/d059561eb043312409a64e0b97b986a5 to your computer and use it in GitHub Desktop.
record.metadata = {
url: document.location.href,
referrer: document.referrer,
cookie: navigator.cookieEnabled ? document.cookie : 'disabled',
language: navigator.language,
connection: navigator.connection.effectiveType,
hasFocus: document.hasFocus(),
readyState: document.readyState,
secondsIn: Math.round(performance.now() / 1000), // page age in seconds
heap: Math.round(performance.memory.usedJSHeapSize / 1048576), // MB of heap used
heapPercent: Math.round(performance.memory.usedJSHeapSize / performance.memory.jsHeapSizeLimit * 100), // Percent of heap used
};
...
sendError(record);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment