Installation
Get started with MentiQ Analytics SDK by installing it in your project.
Package managers
Install the SDK using your preferred package manager:
Peer dependencies
The SDK requires React 16.8 or higher. If you’re using React 16.x, make sure you have hooks support:
{
"dependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
}
Most modern React applications already meet these requirements. React 17+ and React 18+ are fully supported.
Optional dependencies
For advanced features, install these optional packages:
Session recording
To enable session recording with replay capabilities, install rrweb:
Then enable it in your configuration:
<MentiqAnalyticsProvider
config={{
apiKey: "your-api-key",
projectId: "your-project-id",
enableSessionRecording: true,
}}
>
<App />
</MentiqAnalyticsProvider>
Session recording captures user interactions. Make sure to:
- Add proper privacy notices to your users
- Use CSS classes like
mentiq-block and mentiq-mask to protect sensitive data
- Review your local privacy laws and compliance requirements
Verify installation
After installation, verify the SDK is working by importing it:
import { MentiqAnalyticsProvider, useMentiqAnalytics } from 'mentiq-sdk';
console.log('MentiQ Analytics SDK installed successfully!');
If you see no errors, you’re ready to move on to the quickstart guide.
TypeScript support
MentiQ Analytics SDK includes TypeScript definitions out of the box. No additional @types packages are needed.
import type {
AnalyticsConfig,
EventProperties,
SessionData,
PerformanceData,
} from 'mentiq-sdk';
const config: AnalyticsConfig = {
apiKey: 'your-api-key',
projectId: 'your-project-id',
enableHeatmapTracking: true,
batchSize: 20,
};
Next steps
Quickstart guide
Set up your first tracked event in under 5 minutes