UNPKG

@mira-network/mira-data-stream

Version:

JavaScript SDK for Mira Data Stream analytics and event tracking

50 lines (49 loc) 1.8 kB
import { MiraAnalytics } from './analytics'; import { MiraOptions, EventProperties, TrackOptions } from './types'; export { MiraOptions, EventProperties, TrackOptions }; /** * Track an event * @param eventName Name of the event to track * @param properties Event properties * @param options Additional options for this event * @returns The default MiraAnalytics instance */ export declare function track(eventName: string, properties?: EventProperties, options?: TrackOptions): MiraAnalytics; /** * Identify a user * @param userId Unique identifier for the user * @param traits User properties/traits * @returns The default MiraAnalytics instance */ export declare function identify(userId: string, traits?: EventProperties): MiraAnalytics; /** * Track a page view * @param name Page name * @param properties Page properties * @param options Additional options for this event * @returns The default MiraAnalytics instance */ export declare function page(name?: string | null, properties?: EventProperties, options?: TrackOptions): MiraAnalytics; /** * Set the write key for authentication * @param writeKey The write key to use for authentication * @returns The default MiraAnalytics instance */ export declare function setWriteKey(writeKey: string): MiraAnalytics; /** * Flush the event queue manually * @returns A promise that resolves when the queue has been flushed */ export declare function flush(): Promise<void>; /** * Reset the user identity * @returns The default MiraAnalytics instance */ export declare function reset(): MiraAnalytics; /** * Initialize the SDK with custom options * @param options Configuration options * @returns A new MiraAnalytics instance */ export declare function init(options?: MiraOptions): MiraAnalytics; export { MiraAnalytics };