/** * @youranalytics/web-sdk * Lightweight analytics SDK optimized for slow networks * @license MIT */ export { Analytics, createAnalytics } from './analytics'; export type { AnalyticsConfig, ResolvedConfig, RawEvent, QueuedEvent, UtmParams, ConnectionType, NetworkInfo, EventBatch, AdaptiveSettings as AdaptiveSettingsType, SdkState, VisitorId, SessionId, } from './types'; export { isValidEvent, isValidConfig, isValidQueuedEvent, isValidUtmParams, createVisitorId, createSessionId, DEFAULT_CONFIG, } from './types'; export { generateId, getVisitorId, getSessionId, getItem, setItem, getSessionItem, setSessionItem, isStorageAvailable, resetStorageCache, clearVisitorId, clearSessionId, STORAGE_KEYS, } from './storage'; export { parseQueryString, getUtmParams, getConnectionInfo, getConnectionType, isBot, debounce, throttle, supportsBeacon, supportsFetch, supportsCompression, resetCapabilityCache, sanitizeEventName, sanitizeProperties, getPageUrl, getPageTitle, getReferrer, getUserAgent, getScreenDimensions, } from './utils'; export { sendBeacon, sendFetch, sendWithRetry, send, queueOfflineEvents, getOfflineEvents, clearOfflineEvents, isOffline, onOnline, setDebugMode, NetworkError, } from './network'; export { NetworkAdapter, RetryStrategy, EventPriority, sortByPriority, assignPriority, isDataSaverEnabled, getRtt, getDownlink, sendAdaptive, getNetworkAdapter, resetNetworkAdapter, type AdaptiveSettings, type BatchingStrategy, type PrioritizedEvent, } from './network-adapter'; import { Analytics } from './analytics'; import type { AnalyticsConfig } from './types'; /** * Version of the SDK */ import { VERSION } from './version'; export { VERSION }; /** * Global analytics interface for script tag usage. * Provides a simple API that can be accessed via window.analytics */ export interface GlobalAnalytics { /** SDK version */ readonly version: string; /** Current analytics instance (null if not initialized) */ instance: Analytics | null; /** * Initialize the analytics SDK * @param apiKey - Your API key from the analytics dashboard * @param config - Optional configuration overrides * @returns The Analytics instance */ init(apiKey: string, config?: Partial>): Analytics; /** * Track a custom event * @param event - Event name * @param properties - Optional event properties */ track(event: string, properties?: Record): void; /** * Track a page view */ trackPageView(): void; /** * Get the current visitor ID * @returns Visitor ID or null if not initialized */ getVisitorId(): string | null; /** * Get the current session ID * @returns Session ID or null if not initialized */ getSessionId(): string | null; /** * Manually flush queued events * @returns Promise that resolves when flush is complete */ flush(): Promise; /** * Destroy the analytics instance and clean up */ destroy(): void; } /** * Global analytics instance */ declare const globalAnalytics: GlobalAnalytics; /** * Default export is the global analytics object. * Can be used as: import analytics from '@youranalytics/web-sdk' */ export default globalAnalytics; //# sourceMappingURL=index.d.ts.map