Skip to main content

Introduction to MentiQ Analytics SDK

MentiQ Analytics SDK is a comprehensive analytics solution designed specifically for React and Next.js applications. It provides everything you need to understand user behavior, track engagement, and optimize your application’s performance.

Why MentiQ?

MentiQ combines powerful analytics capabilities with an intuitive developer experience. Built with TypeScript, it offers full type safety and seamless integration with modern React workflows.

Easy integration

Get started in minutes with a simple provider wrapper and React hooks

Advanced tracking

Track events, page views, user interactions, and custom metrics out of the box

Session recording

Replay user sessions with rrweb integration and privacy controls

Performance monitoring

Monitor Core Web Vitals and custom performance metrics automatically

Key features

Core analytics

  • Event tracking - Track custom events with rich properties
  • Page view tracking - Automatic page view detection with route changes
  • User identification - Associate events with authenticated users
  • Event batching - Efficient queuing with configurable batch sizes and retry logic
  • Session management - Comprehensive session tracking with engagement metrics

Advanced capabilities

All advanced features are optional and can be enabled individually through configuration.
  • Heatmap tracking - Capture click, hover, and scroll interactions for visual analysis
  • Session recording - Record and replay user sessions with privacy-safe masking
  • Error tracking - Automatic JavaScript error and unhandled rejection capture
  • Performance analytics - Core Web Vitals (LCP, FID, CLS) and custom measurements
  • Onboarding funnels - Track user activation flows with completion and dropoff analysis
  • A/B testing - Experiment management with automatic variant assignment

Developer experience

  • React hooks - Intuitive hooks like useMentiqAnalytics(), useSessionTracking(), and more
  • Pre-built components - TrackView, TrackClick, TrackForm, and other tracking components
  • TypeScript support - Full type safety with comprehensive type definitions
  • Next.js optimized - Works seamlessly with both App Router and Pages Router
  • Offline support - Queue events when offline and sync when connection returns

Quick example

Here’s how simple it is to add analytics to your React app:
import { MentiqAnalyticsProvider, useMentiqAnalytics } from 'mentiq-sdk';

function App() {
  return (
    <MentiqAnalyticsProvider
      config={{
        apiKey: "your-api-key",
        projectId: "your-project-id",
        enableAutoPageTracking: true,
      }}
    >
      <Dashboard />
    </MentiqAnalyticsProvider>
  );
}

function Dashboard() {
  const { track, identify } = useMentiqAnalytics();

  const handlePurchase = () => {
    track('purchase_completed', {
      product_id: 'prod_123',
      amount: 99.99,
      currency: 'USD',
    });
  };

  return <button onClick={handlePurchase}>Buy Now</button>;
}

Use cases

MentiQ Analytics SDK is perfect for:
  • SaaS applications - Track feature usage, user activation, and churn risk
  • E-commerce platforms - Monitor product views, cart interactions, and conversion funnels
  • Content platforms - Measure engagement with scroll tracking and time-on-page metrics
  • Web applications - Understand user behavior and optimize critical user journeys

What’s next?

Installation

Install the SDK with npm, yarn, or pnpm

Quickstart guide

Get up and running with your first tracked event

Build docs developers (and LLMs) love