@brainfish-ai/web-tracker
Version:
Brainfish Tracker for Web
47 lines (46 loc) • 1.7 kB
TypeScript
import { TrackerSdkOptions, TrackProperties, TrackerSdk } from '@brainfish-ai/tracker-sdk';
export type * from '@brainfish-ai/tracker-sdk';
export type TrackerOptions = TrackerSdkOptions & {
trackOutgoingLinks?: boolean;
trackScreenViews?: boolean;
trackAttributes?: boolean;
trackHashChanges?: boolean;
enableRecording?: boolean;
recordingBlocklist?: string[];
_allowLocalhostRecording?: boolean;
};
export declare const VERSION: string;
export declare class Tracker extends TrackerSdk {
options: TrackerOptions;
private lastPath;
private debounceTimer;
private readonly agent;
private readonly sessionManager;
private readonly recordingBlocklist;
private isRecordingActive;
constructor(options: TrackerOptions);
private debounce;
private isServer;
trackOutgoingLinks(): void;
trackScreenViews(): void;
trackAttributes(): void;
startRecording(): void;
screenView(properties?: TrackProperties): Promise<void>;
screenView(path: string, properties?: TrackProperties): Promise<void>;
/**
* Handles recording events to the server and manages session state transitions.
* @param events Array of events to be recorded
* @returns Promise that resolves when events are recorded and session is managed
*/
private recordEventsToServer;
private sendScreenViewEvent;
/**
* Disables privacy-sensitive tracking features and stops active recording.
*/
disableTracking(): void;
/**
* Re-enables privacy-sensitive tracking features.
* Note: Full effect requires a page reload to restart recording and event listeners.
*/
enableTracking(): void;
}