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 767 B
import {} from '../core/AnalyticsClient'; import { buildSearchEvent, buildShareEvent } from '../domain/contentTracking'; import {} from '../types/events'; import { getMeasurementId } from './utils'; export class ContentTracker { constructor(client) { this.client = client; } search(params) { const measurementId = getMeasurementId(params, this.client); const fullParams = { ...params, measurementId }; return this.client.track(buildSearchEvent(fullParams)); } share(params) { const measurementId = getMeasurementId(params, this.client); const fullParams = { ...params, measurementId }; return this.client.track(buildShareEvent(fullParams)); } } //# sourceMappingURL=ContentTracker.js.map