@dotcms/analytics
Version:
Official JavaScript library for Content Analytics with DotCMS.
29 lines (28 loc) • 974 B
TypeScript
import { DotCMSAnalyticsConfig, DotCMSAnalyticsEventContext, DotCMSEvent } from '../models';
/**
* Creates a queue manager for batching analytics events.
* Uses factory function pattern consistent with the plugin architecture.
*/
export declare const createAnalyticsQueue: (config: DotCMSAnalyticsConfig) => {
/**
* Initialize the queue with smart batching
*/
initialize: () => void;
/**
* Add event to queue
* smartQueue handles all batching logic automatically:
* - Sends immediately when eventBatchSize reached (with throttle: false)
* - Sends pending events every flushInterval
*/
enqueue: (event: DotCMSEvent, context: DotCMSAnalyticsEventContext) => void;
/**
* Get queue size for debugging
* Returns the number of events in smartQueue
*/
size: () => number;
/**
* Clean up queue resources
* Flushes remaining events and cleans up listeners
*/
cleanup: () => void;
};