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

33 lines 1.02 kB
import {} from '../types/common'; import {} from '../types/events'; export function buildExceptionEvent(params) { if (!params.measurementId) { throw new Error('measurementId is required for exception events'); } return { name: 'exception', measurementId: params.measurementId, params: { description: params.description, fatal: params.fatal ?? false, ...(params.extraParams ?? {}), }, }; } export function buildTimingCompleteEvent(params) { if (!params.measurementId) { throw new Error('measurementId is required for timing_complete events'); } return { name: 'timing_complete', measurementId: params.measurementId, params: { name: params.name, value: params.value, event_category: params.event_category, event_label: params.event_label, ...(params.extraParams ?? {}), }, }; } //# sourceMappingURL=errorTracking.js.map