Skip to main content

TypeScript Support

MentiQ Analytics SDK is built with TypeScript and provides comprehensive type definitions for all features. This guide covers all the types, interfaces, and type-safe patterns you’ll use.

Core Configuration

AnalyticsConfig

The main configuration interface for initializing the Analytics SDK:

Usage Example

Event Types

EventProperties

Base type for all event properties:

PageProperties

Properties for page view events:
Example:

UserProperties

Properties for user identification:
Example:

Subscription Tracking Types

SubscriptionProperties

Comprehensive subscription data structure:
Example:

PaymentEventProperties

Properties for payment events:
Example:

ChurnRiskMetrics

Churn risk analysis result:
Example:

Session Types

SessionData

Real-time session tracking data:
Example:

Performance Types

PerformanceData

Core Web Vitals and performance metrics:
Example:

Error Tracking Types

ErrorData

Error information structure:
Example:

Heatmap Types

HeatmapData

User interaction data for heatmaps:

Analytics Instance Type

AnalyticsInstance

Complete interface for the Analytics class:

A/B Testing Types

Experiment

Variant

ExperimentAssignment

Type Guards

Create type-safe helpers for runtime type checking:

Generic Event Typing

Create strongly-typed custom events:

Utility Types

Useful type utilities for common patterns:

Next Steps

Next.js Integration

Integrate with Next.js App and Pages Router

Event Batching

Learn about the queuing and batching system