@randyd45/web-behavior-tracker
Version:
A framework-agnostic package for tracking user behavior on web forms
50 lines (49 loc) • 1.46 kB
TypeScript
import { BehaviorEvent, TrackingOptions } from './types.js';
/**
* Handles custom events that can be manually triggered by the application
*/
export declare class CustomEventHandler {
private options;
private customEvents;
constructor(options: TrackingOptions);
/**
* Creates and logs a custom event
*/
createCustomEvent(eventName: string, customData: Record<string, any>, target: HTMLElement | undefined, onEventCreated: (event: BehaviorEvent) => void): BehaviorEvent;
/**
* Gets all custom events
*/
getCustomEvents(): BehaviorEvent[];
/**
* Gets custom events by name
*/
getCustomEventsByName(eventName: string): BehaviorEvent[];
/**
* Gets custom events count
*/
getCustomEventsCount(): number;
/**
* Gets custom events count by name
*/
getCustomEventsCountByName(eventName: string): number;
/**
* Clears all custom events
*/
clearCustomEvents(): void;
/**
* Gets custom events statistics
*/
getCustomEventsStats(): Record<string, number>;
/**
* Gets recent custom events (last N events)
*/
getRecentCustomEvents(count?: number): BehaviorEvent[];
/**
* Checks if a custom event has been triggered
*/
hasCustomEvent(eventName: string): boolean;
/**
* Gets the last occurrence of a custom event
*/
getLastCustomEvent(eventName?: string): BehaviorEvent | null;
}