import type { TrackerConfig, UserIdentity } from "./types"; import { type FunnelDefinition } from "./utils/journey"; /** * WaveTrace Tracker - Enhanced user tracking with comprehensive identification */ export declare class WaveTracker { private config; private clickTrackingConfig; private eventQueue; private userIdentity; private sessionId; private anonymousId; private batchTimer; private clickListener; private engagementTracker; private journeyTracker; private funnelTracker; private deviceContext; private initPromise; private walletDetector; private isOnline; private onlineListener; private offlineListener; private beforeUnloadListener; constructor(config: TrackerConfig); /** * Initialize async features (device context) */ private initializeAsync; /** * Setup auto-wallet detection */ private setupWalletDetection; /** * Load offline queue from localStorage */ private loadOfflineQueue; /** * Save offline queue to localStorage */ private saveOfflineQueue; /** * Setup online/offline support */ private setupOfflineSupport; /** * Set user identification information */ identify(identity: UserIdentity): void; /** * Connect wallet for DApp tracking (convenience method) * This is the preferred method for DApps as it uses wallet as the primary identifier */ connectWallet(walletAddress: string, additionalData?: Omit): Promise; /** * Disconnect wallet (for DApps) */ disconnectWallet(): Promise; /** * Manually track a click on an element (useful for programmatic tracking) * @param element The element that was clicked * @param additionalProperties Additional properties to include in the event */ trackClick(element: HTMLElement, additionalProperties?: Record): Promise; /** * Build comprehensive event data with all enhanced tracking */ private buildEventData; /** * Track a page view */ trackPageView(properties?: Record): Promise; /** * Track a custom event */ track(eventName: string, properties?: Record): Promise; /** * Track a blockchain transaction with automatic lifecycle tracking * Tracks: initiated, pending, executed, and failed states * * @param eventName Base name for the event (e.g., 'swap', 'stake') * @param txFunction Async function that returns a transaction * @param properties Additional properties to include * @returns The transaction result * * @example * const tx = await tracker.trackTransaction( * 'swap', * async () => contract.swap(params), * { fromToken: 'ETH', toToken: 'USDC', amount: '1.5' } * ); */ trackTransaction Promise; }>(eventName: string, txFunction: () => Promise, properties?: Record): Promise; /** * Define a funnel for conversion tracking */ defineFunnel(funnel: FunnelDefinition): void; /** * Track funnel step completion */ trackFunnelStep(funnelName: string, stepName: string, properties?: Record): Promise; /** * Get detailed user identity information */ getUserIdentity(): { authenticated: UserIdentity; sessionId: string; isReturningUser: boolean; daysSinceFirstVisit: number; firstSeen: string | null; lastSeen: string | null; visitCount: number; anonymousId: string; }; /** * Get current engagement metrics */ getEngagement(): { timeSpent: number; activeTime: number; scrollDepth: number; scrollMilestones: number[]; clicks: number; mouseMoves: number; focusCount: number; blurCount: number; engagementScore: number; isEngaged: boolean; } | null; /** * Get user journey */ getJourney(): import("./utils/journey").Journey | null; /** * Get journey summary */ getJourneySummary(): { totalEvents: number; pageviews: number; clicks: number; customEvents: number; pagesVisited: number; uniquePages: string[]; durationMinutes: number; startTime: string; lastUpdate: string; } | null; /** * Get the trackable element (finds button/link parent if clicked on child element) */ private getTrackableElement; /** * Check if an element should be tracked based on click tracking configuration */ private shouldTrackClick; /** * Enable automatic click tracking */ private enableClickTracking; /** * Disable automatic click tracking */ disableClickTracking(): void; /** * Add event to queue and trigger send if needed */ private addEvent; /** * Schedule a batch send using timeout */ private scheduleBatchSend; /** * Send all queued events to the endpoint */ private sendEvents; /** * Send events without retry (simple mode) */ private sendEventsSimple; /** * Send events with exponential backoff retry */ private sendEventsWithRetry; /** * Manually flush all queued events */ flush(): Promise; /** * Clean up tracker resources */ destroy(): void; /** * Debug logging */ private log; } //# sourceMappingURL=tracker.d.ts.map