@mira-network/mira-data-stream
Version:
JavaScript SDK for Mira Data Stream analytics and event tracking
66 lines (65 loc) • 1.32 kB
TypeScript
/**
* Options for configuring the MiraAnalytics instance
*/
export interface MiraOptions {
/**
* API URL for the Mira backend
*/
apiUrl?: string;
/**
* User ID for identifying the current user
*/
userId?: string | null;
/**
* Anonymous ID for tracking non-logged-in users
*/
anonymousId?: string;
/**
* Write key for authentication with the Mira backend
*/
writeKey?: string;
/**
* Interval in milliseconds for flushing the event queue
*/
flushInterval?: number;
}
/**
* Properties for a tracking event
*/
export interface EventProperties {
[]: any;
}
/**
* Options for a specific tracking call
*/
export interface TrackOptions {
/**
* Override the write key for this specific event
*/
writeKey?: string;
}
/**
* Event data structure
*/
export interface EventData {
/**
* Name of the event
*/
event_name: string;
/**
* Properties/metadata for the event
*/
properties: EventProperties;
/**
* User ID if available
*/
user_id?: string | null;
/**
* Anonymous ID for tracking when user_id is not available
*/
anonymous_id: string;
/**
* ISO timestamp when the event was created
*/
timestamp: string;
}