/** * Attribution and Referral Tracking for Grain Analytics * Handles referral categorization and first-touch attribution */ export type ReferrerCategory = 'organic' | 'paid' | 'social' | 'direct' | 'email' | 'referral'; export interface UTMParameters { utm_source?: string; utm_medium?: string; utm_campaign?: string; utm_term?: string; utm_content?: string; } export interface FirstTouchAttribution { source: string; medium: string; campaign: string; referrer: string; referrer_category: ReferrerCategory; timestamp: number; } /** * Categorize referrer based on domain and parameters */ export declare function categorizeReferrer(referrer: string, currentUrl?: string): ReferrerCategory; /** * Parse UTM parameters from URL */ export declare function parseUTMParameters(url: string): UTMParameters; /** * Get first-touch attribution from localStorage */ export declare function getFirstTouchAttribution(tenantId: string): FirstTouchAttribution | null; /** * Set first-touch attribution in localStorage */ export declare function setFirstTouchAttribution(tenantId: string, attribution: FirstTouchAttribution): void; /** * Get or create first-touch attribution */ export declare function getOrCreateFirstTouchAttribution(tenantId: string, referrer: string, currentUrl: string, utmParams: UTMParameters): FirstTouchAttribution; export declare function getSessionUTMParameters(): UTMParameters | null; export declare function setSessionUTMParameters(params: UTMParameters): void; /** * Clear session UTM parameters */ export declare function clearSessionUTMParameters(): void; //# sourceMappingURL=attribution.d.ts.map