UNPKG

@shopana/ga

Version:

Type-safe Google Analytics 4 (GA4) tracking library for React and Next.js with ecommerce support, event batching, and SSR compatibility

20 lines 798 B
import {} from '../core/AnalyticsClient'; import { buildExceptionEvent, buildTimingCompleteEvent, } from '../domain/errorTracking'; import {} from '../types/events'; import { getMeasurementId } from './utils'; export class ErrorTracker { constructor(client) { this.client = client; } exception(params) { const measurementId = getMeasurementId(params, this.client); const fullParams = { ...params, measurementId }; return this.client.track(buildExceptionEvent(fullParams)); } timingComplete(params) { const measurementId = getMeasurementId(params, this.client); const fullParams = { ...params, measurementId }; return this.client.track(buildTimingCompleteEvent(fullParams)); } } //# sourceMappingURL=ErrorTracker.js.map