/** * Click tracking modes */ export type ClickTrackingMode = 'all' | 'important' | 'data-attribute' | 'custom'; /** * Click tracking configuration */ export interface ClickTrackingConfig { /** * Click tracking mode * - 'all': Track all clicks on the page * - 'important': Track only buttons, links, and elements with data-track * - 'data-attribute': Track only elements with data-track attribute * - 'custom': Use custom selectors * @default 'important' */ mode?: ClickTrackingMode; /** * Custom CSS selectors to track (only used when mode is 'custom') * @example ['button', 'a', '[role="button"]', '.track-me'] */ customSelectors?: string[]; /** * Elements to ignore (CSS selectors) * @example ['[data-track-ignore]', '.no-track'] */ ignoreSelectors?: string[]; } /** * Retry configuration for failed requests */ export interface RetryConfig { /** * Enable retry logic * @default true */ enabled?: boolean; /** * Maximum number of retry attempts * @default 3 */ maxRetries?: number; /** * Initial delay in milliseconds * @default 1000 */ initialDelay?: number; /** * Backoff multiplier (exponential backoff) * @default 2 */ backoffMultiplier?: number; } /** * Configuration options for the WaveTrace tracker */ export interface TrackerConfig { /** * Your tracking endpoint URL where events will be sent */ endpoint: string; /** * Auto-detect wallet connections (MetaMask, Coinbase, etc.) * Automatically tracks wallet connections, disconnections, and switches * @default false */ autoDetectWallet?: boolean; /** * Enable offline queue with localStorage persistence * Events are saved locally and sent when back online * @default true */ offlineQueue?: boolean; /** * Maximum number of events to store offline * @default 100 */ maxOfflineEvents?: number; /** * Retry configuration for failed requests */ retry?: RetryConfig; /** * Whether to automatically track page views * @default true */ autoTrackPageViews?: boolean; /** * Whether to automatically track clicks * Can be a boolean or detailed configuration * @default true (uses 'important' mode) */ autoTrackClicks?: boolean | ClickTrackingConfig; /** * Batch size for sending events (0 = send immediately) * @default 10 */ batchSize?: number; /** * Maximum time in ms to wait before sending batched events * @default 5000 */ batchTimeout?: number; /** * Whether to include detailed referrer information * @default true */ includeReferrer?: boolean; /** * Whether to include user agent information * @default true */ includeUserAgent?: boolean; /** * Custom headers to include in tracking requests */ customHeaders?: Record; /** * Whether to enable debug logging * @default false */ debug?: boolean; /** * Enable engagement tracking (time on page, scroll depth, etc.) * @default false */ enableEngagement?: boolean; /** * Enable user journey tracking * @default false */ enableJourney?: boolean; /** * Include detailed device and browser context * @default false */ includeDeviceContext?: boolean; } /** * User identification information */ export interface UserIdentity { /** * Unique user identifier */ userId?: string; /** * Username or display name */ username?: string; /** * Crypto wallet address */ wallet?: string; /** * Email address */ email?: string; /** * Custom user properties */ properties?: Record; } /** * Base tracking event structure */ export interface TrackingEvent { /** * Event type identifier */ type: string; /** * Timestamp when event occurred (ISO 8601) */ timestamp: string; /** * Current page URL */ url: string; /** * Page title */ title: string; /** * Referrer URL */ referrer?: string; /** * User agent string */ userAgent?: string; /** * Screen dimensions */ screen?: { width: number; height: number; }; /** * Viewport dimensions */ viewport?: { width: number; height: number; }; /** * User identification */ user?: UserIdentity; /** * Event-specific properties */ properties?: Record; /** * Session identifier */ sessionId?: string; /** * Anonymous user ID (persistent across sessions) */ anonymousId?: string; /** * Device and browser context */ context?: any; /** * Engagement metrics */ engagement?: { timeSpent?: number; scrollDepth?: number; clicks?: number; engagementScore?: number; }; /** * User journey information */ journey?: { eventCount?: number; pagesVisited?: number; durationMinutes?: number; }; /** * Attribution data */ attribution?: { utmParams?: Record; referrerType?: string; firstTouch?: any; }; } /** * Page view tracking event */ export interface PageViewEvent extends TrackingEvent { type: 'pageview'; } /** * Click tracking event */ export interface ClickEvent extends TrackingEvent { type: 'click'; properties: { /** * Element tag name */ tagName: string; /** * Element ID */ id?: string; /** * Element classes */ className?: string; /** * Link href (for anchor tags) */ href?: string; /** * Element text content */ text?: string; /** * Custom identifier from data-track attribute */ dataTrack?: string; /** * Whether this click was manually tracked */ manual?: boolean; /** * X coordinate of click */ x: number; /** * Y coordinate of click */ y: number; }; } /** * Custom tracking event */ export interface CustomEvent extends TrackingEvent { type: string; properties?: Record; } /** * Wallet connected event (for DApps) */ export interface WalletConnectedEvent extends TrackingEvent { type: 'wallet_connected'; properties: { /** * Wallet address (normalized to lowercase) */ wallet: string; /** * Previous anonymous ID before wallet connection */ previousAnonymousId?: string; /** * Blockchain chain ID (e.g., 1 for Ethereum mainnet) */ chainId?: number; /** * Wallet type/provider (e.g., 'metamask', 'walletconnect', 'coinbase') */ walletType?: string; /** * Additional wallet connection properties */ [key: string]: any; }; } /** * Wallet disconnected event (for DApps) */ export interface WalletDisconnectedEvent extends TrackingEvent { type: 'wallet_disconnected'; properties: { /** * Wallet address that was disconnected */ wallet: string; }; } /** * All possible event types */ export type Event = PageViewEvent | ClickEvent | CustomEvent | WalletConnectedEvent | WalletDisconnectedEvent; //# sourceMappingURL=types.d.ts.map