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

18 lines 576 B
import {} from '../core/AnalyticsClient'; import { buildPageViewEvent } from '../domain/pageTracking'; import {} from '../types/events'; import { getMeasurementId } from './utils'; export class PageTracker { constructor(client) { this.client = client; } async trackPageView(params) { const measurementId = getMeasurementId(params, this.client); const fullParams = { ...params, measurementId, }; return this.client.track(buildPageViewEvent(fullParams)); } } //# sourceMappingURL=PageTracker.js.map