import { DatalyrConfig, EventData, UserProperties, AutoEventConfig, DeferredDeepLinkResult } from './types'; import { AttributionData } from './attribution'; import { SessionData } from './auto-events'; import { AppleSearchAdsAttribution } from './native/DatalyrNativeBridge'; export declare class DatalyrSDK { private state; private httpClient; private eventQueue; private autoEventsManager; private appStateSubscription; private networkStatusUnsubscribe; private cachedAdvertiserInfo; private initializing; private static conversionEncoder?; private static debugEnabled; /** Events that arrived before initialize() completed. Flushed once init finishes. */ private preInitQueue; private static readonly PRE_INIT_QUEUE_MAX; constructor(); /** * Initialize the SDK with configuration */ initialize(config: DatalyrConfig): Promise; /** * Track a custom event */ track(eventName: string, eventData?: EventData): Promise; /** * Track a screen view */ screen(screenName: string, properties?: EventData): Promise; /** * Identify a user */ identify(userId: string, properties?: UserProperties): Promise; /** * Fetch web attribution data for user and merge into mobile session * Called automatically during identify() if email is provided */ /** Stable (cross-launch) non-crypto hash (FNV-1a) so we store no raw email. */ private stableEmailHash; private fetchAndMergeWebAttribution; /** * Fetch deferred web attribution on first app install. * Uses IP-based matching (iOS) or Play Store referrer (Android) to recover * attribution data (fbclid, utm_*, etc.) from a prelander web visit. * Called automatically during initialize() when a fresh install is detected. */ private fetchDeferredWebAttribution; /** * Alias a user (connect anonymous user to known user) */ alias(newUserId: string, previousId?: string): Promise; /** * Reset user data (logout) */ reset(): Promise; /** * Flush queued events immediately */ flush(): Promise; /** * Get SDK status and statistics */ getStatus(): { initialized: boolean; workspaceId: string; visitorId: string; anonymousId: string; sessionId: string; currentUserId?: string; queueStats: any; attribution: any; journey: any; }; /** * Get the persistent anonymous ID */ getAnonymousId(): string; /** * Get detailed attribution data (includes journey tracking data) */ getAttributionData(): AttributionData & Record; /** * Get journey tracking summary */ getJourneySummary(): { hasFirstTouch: boolean; hasLastTouch: boolean; touchpointCount: number; daysSinceFirstTouch: number; sources: string[]; }; /** * Get full customer journey (all touchpoints) */ getJourney(): import("./journey").TouchPoint[]; /** * Set custom attribution data (for testing or manual attribution) */ setAttributionData(data: Partial): Promise; /** * Get current session information from auto-events */ getCurrentSession(): SessionData | null; /** * Force end current session */ endSession(): Promise; /** * Track app update manually */ trackAppUpdate(previousVersion: string, currentVersion: string): Promise; /** * Update auto-events configuration */ updateAutoEventsConfig(config: Partial): void; /** * Track event with automatic SKAdNetwork conversion value encoding * Uses SKAN 4.0 on iOS 16.1+ with coarse values and lock window support */ trackWithSKAdNetwork(event: string, properties?: EventData): Promise; /** * Track purchase with automatic revenue encoding and platform forwarding */ trackPurchase(value: number, currency?: string, productId?: string): Promise; /** * Track subscription with automatic revenue encoding and platform forwarding */ trackSubscription(value: number, currency?: string, plan?: string): Promise; /** * Track add to cart event */ trackAddToCart(value: number, currency?: string, productId?: string, productName?: string): Promise; /** * Track view content/product event */ trackViewContent(contentId?: string, contentName?: string, contentType?: string, value?: number, currency?: string): Promise; /** * Track initiate checkout event */ trackInitiateCheckout(value: number, currency?: string, numItems?: number, productIds?: string[]): Promise; /** * Track complete registration event */ trackCompleteRegistration(method?: string): Promise; /** * Track search event */ trackSearch(query: string, resultIds?: string[]): Promise; /** * Track lead/contact form submission */ trackLead(value?: number, currency?: string): Promise; /** * Track add payment info event */ trackAddPaymentInfo(success?: boolean): Promise; /** * Get deferred attribution data from platform SDKs */ getDeferredAttributionData(): DeferredDeepLinkResult | null; /** * Get platform integration status */ getPlatformIntegrationStatus(): { appleSearchAds: boolean; playInstallReferrer: boolean; }; /** * Get Apple Search Ads attribution data * Returns attribution if user installed via Apple Search Ads, null otherwise */ getAppleSearchAdsAttribution(): AppleSearchAdsAttribution | null; /** * Get Google Play Install Referrer attribution data (Android only) * Returns referrer data if available, null otherwise */ getPlayInstallReferrer(): Record | null; /** * Get attribution data formatted for Superwall's setUserAttributes() * Returns a flat Record with only non-empty values */ getSuperwallAttributes(): Record; /** * Get attribution data formatted for RevenueCat's Purchases.setAttributes() * Returns a flat Record with $-prefixed reserved keys */ getRevenueCatAttributes(): Record; /** * Update tracking authorization status * Call this AFTER the user responds to the ATT permission dialog */ updateTrackingAuthorization(enabled: boolean): Promise; /** * Handle deferred deep link data from platform SDKs */ private handleDeferredDeepLink; /** * Get conversion value for testing (doesn't send to Apple) */ getConversionValue(event: string, properties?: Record): number | null; /** * Create an event payload with all required data */ private createEventPayload; /** * Load persisted user data */ private loadPersistedUserData; /** * Persist user data to storage */ private persistUserData; /** * Initialize network status monitoring * Automatically updates event queue when network status changes */ private initializeNetworkMonitoring; /** * Set up app state monitoring for lifecycle events (optimized) */ private setupAppStateMonitoring; /** * Refresh session if needed */ private refreshSession; /** * Cleanup and destroy the SDK */ destroy(): void; } declare const datalyr: DatalyrSDK; export declare class Datalyr { /** * Initialize Datalyr with SKAdNetwork conversion value encoding */ static initialize(config: DatalyrConfig): Promise; /** * Track event with automatic SKAdNetwork conversion value encoding */ static trackWithSKAdNetwork(event: string, properties?: Record): Promise; /** * Track purchase with automatic revenue encoding */ static trackPurchase(value: number, currency?: string, productId?: string): Promise; /** * Track subscription with automatic revenue encoding */ static trackSubscription(value: number, currency?: string, plan?: string): Promise; /** * Get conversion value for testing (doesn't send to Apple) */ static getConversionValue(event: string, properties?: Record): number | null; static track(eventName: string, eventData?: EventData): Promise; static screen(screenName: string, properties?: EventData): Promise; static identify(userId: string, properties?: UserProperties): Promise; static alias(newUserId: string, previousId?: string): Promise; static reset(): Promise; static flush(): Promise; static getStatus(): { initialized: boolean; workspaceId: string; visitorId: string; anonymousId: string; sessionId: string; currentUserId?: string; queueStats: any; attribution: any; journey: any; }; static getAnonymousId(): string; static getAttributionData(): AttributionData; static setAttributionData(data: Partial): Promise; static getCurrentSession(): SessionData | null; static endSession(): Promise; static trackAppUpdate(previousVersion: string, currentVersion: string): Promise; static updateAutoEventsConfig(config: Partial): void; static trackAddToCart(value: number, currency?: string, productId?: string, productName?: string): Promise; static trackViewContent(contentId?: string, contentName?: string, contentType?: string, value?: number, currency?: string): Promise; static trackInitiateCheckout(value: number, currency?: string, numItems?: number, productIds?: string[]): Promise; static trackCompleteRegistration(method?: string): Promise; static trackSearch(query: string, resultIds?: string[]): Promise; static trackLead(value?: number, currency?: string): Promise; static trackAddPaymentInfo(success?: boolean): Promise; static getDeferredAttributionData(): DeferredDeepLinkResult | null; static getPlatformIntegrationStatus(): { appleSearchAds: boolean; playInstallReferrer: boolean; }; static getAppleSearchAdsAttribution(): AppleSearchAdsAttribution | null; static updateTrackingAuthorization(enabled: boolean): Promise; static getSuperwallAttributes(): Record; static getRevenueCatAttributes(): Record; } export default datalyr;