Skip to main content

Quickstart guide

This guide will help you set up MentiQ Analytics SDK and track your first event.

Prerequisites

Before starting, make sure you have:
  • A React or Next.js application (React 16.8+)
  • Your MentiQ API key and project ID
  • The SDK installed (see Installation)

Basic setup

1

Wrap your app with the provider

Import MentiqAnalyticsProvider and wrap your app at the root level:
app.tsx
Replace your-api-key and your-project-id with your actual credentials from the MentiQ dashboard.
2

Use the analytics hook

In any component, use the useMentiqAnalytics hook to access tracking methods:
dashboard.tsx
3

Identify users

When a user logs in, identify them to associate events with their account:
4

Verify in your dashboard

Open your MentiQ dashboard and verify that events are being received. You should see:
  • Page view events (if enableAutoPageTracking is enabled)
  • Custom events from your track() calls
  • User identification data

Complete working example

Here’s a complete example showing authentication and event tracking:

Next.js setup

For Next.js applications, the setup differs slightly based on your router:
Make sure to prefix your environment variables with NEXT_PUBLIC_ to expose them to the browser.

Configuration options

Here are the most common configuration options:

Using tracking components

MentiQ provides pre-built components for common tracking scenarios:

TrackView - Track element visibility

TrackClick - Track clicks

TrackForm - Track form submissions

Monitoring session data

Track real-time session metrics with the useSessionTracking hook:

Next steps

Now that you have basic tracking set up, explore more advanced features:

Session recording

Record and replay user sessions with privacy controls

Heatmap tracking

Visualize user interactions with click and scroll heatmaps

Error tracking

Automatically capture JavaScript errors and exceptions

Performance monitoring

Track Core Web Vitals and custom performance metrics