Skip to main content

AnalyticsConfig

The main configuration interface for initializing the MentiQ Analytics SDK.
export interface AnalyticsConfig {
  apiKey: string;
  projectId: string;
  endpoint?: string;
  debug?: boolean;
  userId?: string;
  sessionTimeout?: number;
  batchSize?: number;
  flushInterval?: number;
  enableAutoPageTracking?: boolean;
  enablePerformanceTracking?: boolean;
  enableHeatmapTracking?: boolean;
  enableSessionRecording?: boolean;
  enableErrorTracking?: boolean;
  maxQueueSize?: number;
  retryAttempts?: number;
  retryDelay?: number;
  enableABTesting?: boolean;
  abTestConfig?: ABTestConfig;
}

Properties

apiKey
string
required
Your MentiQ Analytics API key used for authentication.
projectId
string
required
The unique identifier for your project in MentiQ Analytics.
endpoint
string
Custom API endpoint URL. Defaults to MentiQ’s standard endpoint if not specified.
debug
boolean
Enable debug mode for verbose logging. Useful for development and troubleshooting.
userId
string
Initial user ID to associate with analytics events.
sessionTimeout
number
Time in milliseconds before a session expires due to inactivity.
batchSize
number
Number of events to batch before sending to the server.
flushInterval
number
Interval in milliseconds for automatically flushing queued events.
enableAutoPageTracking
boolean
Automatically track page views when enabled.
enablePerformanceTracking
boolean
Enable automatic tracking of web performance metrics.
enableHeatmapTracking
boolean
Enable heatmap data collection for click and scroll tracking.
enableSessionRecording
boolean
Enable session recording functionality.
enableErrorTracking
boolean
Automatically track JavaScript errors and unhandled promise rejections.
maxQueueSize
number
Maximum number of events to queue before forcing a flush.
retryAttempts
number
Number of retry attempts for failed event submissions.
retryDelay
number
Delay in milliseconds between retry attempts.
enableABTesting
boolean
Enable A/B testing functionality.
abTestConfig
ABTestConfig
Configuration options for A/B testing features.

ABTestConfig

Configuration options for A/B testing functionality.
export interface ABTestConfig {
  enableABTesting?: boolean;
  assignmentCacheTTL?: number;
  autoTrackExposures?: boolean;
}

Properties

enableABTesting
boolean
Enable or disable A/B testing functionality.
assignmentCacheTTL
number
Cache assignment for this many milliseconds. Default: 5 minutes (300000ms).
autoTrackExposures
boolean
Automatically track when a user is exposed to a variant.

AssignmentOptions

Options for experiment assignment requests.
export interface AssignmentOptions {
  userId?: string;
  anonymousId?: string;
  forceRefresh?: boolean;
}

Properties

userId
string
User ID to use for assignment. Overrides the SDK’s current user ID.
anonymousId
string
Anonymous ID to use for assignment. Overrides the SDK’s current anonymous ID.
forceRefresh
boolean
Ignore cache and fetch a fresh assignment from the server.

Build docs developers (and LLMs) love