Overview
The Journium React SDK provides React-specific components, hooks, and utilities to seamlessly integrate conversion tracking into your React applications. It works with React 16.8+ and supports both functional and class components.Installation
Install the React SDK via npm:Basic Setup
1. Wrap Your App with JourniumProvider
2. Use Journium in Components
Configuration Options
JourniumProvider Props
Hooks
useJournium Hook
The main hook for interacting with Journium:useJourniumEvent Hook
A convenient hook for tracking events with automatic cleanup:useJourniumUser Hook
Hook for user identification and management:Components
JourniumTracker Component
A declarative component for tracking events:JourniumClick Component
Automatically track click events:JourniumForm Component
Track form interactions and submissions:Route Tracking
Automatic Route Tracking
Works automatically with React Router:Manual Route Tracking
For custom routing solutions:Performance Tracking
Component Render Time Tracking
Automatic Performance Tracking
Error Tracking
Error Boundary Integration
Manual Error Tracking
TypeScript Support
Full TypeScript definitions are included:Best Practices
1. Provider Placement
Place the JourniumProvider as high as possible in your component tree:2. Conditional Tracking
3. Environment-Specific Configuration
4. Memoization for Performance
Advanced Usage
Custom Context Provider
Dynamic Configuration
Troubleshooting
Common Issues
Hook called outside of provider- Ensure all components using Journium hooks are wrapped in JourniumProvider
- Check that you’re using the correct environment setting
- Verify your development project ID and API key
- Use React DevTools Profiler to identify unnecessary re-renders
- Memoize event tracking functions when appropriate
- Consider batching events for high-frequency interactions