Reporting API brings a common infrastructure for the browser to send reports for various issues: CSP violations, deprecations, browser interventions, network errors, and feature policy violations.
ReportingObserver gives developers insight into what their code is doing in the wild. ReportingObserver surfaces information on issues like deprecations and interventions, messages that were previously only available in the DevTools console.
The sw-offline-google-analytics library gives you everything you need.
Chrome 39 implements the Beacon API, which allows to send small async HTTP requests during the page unload events.