mentiq-sdk
Version:
A powerful analytics SDK for React and Next.js with heatmap tracking, session monitoring, and performance analytics
48 lines • 1.72 kB
TypeScript
import { AnalyticsEvent } from "./types";
export declare function generateId(): string;
export declare function getSessionId(): string;
export declare function getAnonymousId(): string;
export declare function getUserId(): string | null;
export declare function setUserId(userId: string): void;
export declare function clearUserId(): void;
export declare function getContext(): {
page?: import("./types").PageProperties;
userAgent?: string;
timezone?: string;
locale?: string;
screen?: {
width: number;
height: number;
};
library: {
name: string;
version: string;
};
performance?: import("./types").PerformanceData;
heatmap?: import("./types").HeatmapData;
session?: import("./types").SessionData;
error?: import("./types").ErrorData;
};
export declare function createEvent(type: AnalyticsEvent["type"], event?: string, properties?: any): AnalyticsEvent;
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): T;
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): T;
/**
* Detect acquisition channel from URL parameters and referrer
*/
export declare function detectChannel(): string;
/**
* Get channel from URL parameters (for manual checking)
*/
export declare function getChannelFromUrl(url?: string): string | null;
/**
* Get user email from storage or auth session
* Checks multiple sources in order of priority:
* 1. Mentiq-specific storage
* 2. NextAuth/Auth.js session
* 3. Supabase auth
* 4. Firebase auth
* 5. Clerk auth
* 6. Custom auth patterns
*/
export declare function getUserEmail(): string | null;
//# sourceMappingURL=utils.d.ts.map