@shopana/ga
Version:
Type-safe Google Analytics 4 (GA4) tracking library for React and Next.js with ecommerce support, event batching, and SSR compatibility
28 lines • 1.03 kB
TypeScript
import { type FlushOptions } from '../types/common';
import { type DebugChannel } from '../utils/debugChannel';
import { type PendingEvent, type EventQueueSettings } from '../types/core';
interface EventQueueDependencies {
send: (payload: PendingEvent['payload']) => Promise<void>;
onEvent?: (payload: PendingEvent['payload']) => void;
onFlush?: (count: number) => void;
debugChannel?: DebugChannel;
handleError: (error: Error) => void;
}
export declare class EventQueue {
private settings;
private readonly deps;
private readonly queue;
private flushTimer?;
private isFlushing;
private flushPromise;
constructor(settings: EventQueueSettings, deps: EventQueueDependencies);
enqueue(event: PendingEvent): void;
flush(options?: FlushOptions): Promise<void>;
updateSettings(patch: Partial<EventQueueSettings>): void;
clear(): void;
private scheduleFlush;
private clearFlushTimer;
private processEvent;
}
export {};
//# sourceMappingURL=EventQueue.d.ts.map