📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
added some performance metrics
Blue Mouseec0ece49b170
diff --git a/src/Lib.ts b/src/Lib.tsindex 3af1b50eb..71a9db985 100644--- a/src/Lib.ts+++ b/src/Lib.ts@@ -128,6 +128,41 @@ export class Lib {return this.pageData.actions}+ getPerformanceStats(): object {+ if (!this.canTrack() || !window.performance?.getEntriesByType) {+ return {}+ }++ const perf = window.performance.getEntriesByType('navigation')[0]++ if (!perf) {+ return {}+ }++ return {+ // Network+ // @ts-ignore+ dns: perf.domainLookupEnd - perf.domainLookupStart, // @ts-ignore+ ssl: perf.connectEnd - perf.secureConnectionStart, // @ts-ignore+ conn: perf.connectEnd - perf.connectStart, // @ts-ignore+ resp: perf.responseEnd - perf.responseStart,++ // Frontend+ // @ts-ignore+ render: perf.domComplete - perf.domContentLoadedEventEnd, // @ts-ignore+ dom_load: perf.domContentLoadedEventEnd - perf.responseEnd,++ // Backend+ // @ts-ignore+ ttfb: perf.responseStart - perf.requestStart,+ // fpt: perf.responseEnd - perf.requestStart,+ // tti: perf.domInteractive - perf.requestStart,+ // ttfcp: perf.domContentLoadedEventEnd - perf.requestStart,+ // ttdl: perf.domComplete - perf.requestStart,+ }+ }++private heartbeat(): void {if (!this.pageViewsOptions?.heartbeatOnBackground && document.visibilityState === 'hidden') {return@@ -170,6 +205,9 @@ export class Lib {if (this.checkIgnore(pg)) return+ const perf = this.getPerformanceStats()+ console.log(perf)+const data = {pid: this.projectID,lc: getLocale(),@@ -180,6 +218,7 @@ export class Lib {ca: getUTMCampaign(),unique,pg,+ perf,}this.sendRequest('', data)