Overview
Heatmap tracking captures user interaction data including clicks, mouse movements, and scroll events. This data helps you visualize where users focus their attention and identify engagement patterns across your application.How It Works
When enabled, the SDK automatically tracks:- Click events: Every click with coordinates and target element
- Mouse movements: Sampled mouse position data (debounced to reduce volume)
- Scroll events: Scroll position and depth tracking
Setup
Automatic Data Collection
Once enabled, heatmap data is automatically collected in the background. The SDK:
- Captures click coordinates and element information
- Samples mouse movements every 500ms (debounced)
- Tracks scroll position every 1000ms (debounced)
- Includes viewport dimensions for responsive analysis
Data Structure
Each heatmap event includes:Manual Tracking with Components
For more control, use theHeatmapTracker component to track specific sections:
Use Cases
Optimize CTAs
Identify which buttons and links get the most attention:Analyze Content Engagement
See how far users scroll and where they stop reading:E-commerce Product Pages
Track which product images and details users interact with:Performance Considerations
The SDK uses debouncing to minimize performance impact:
- Mouse movements are sampled every 500ms
- Scroll events are throttled to 1000ms
- Events are batched before sending to reduce network requests
Implementation Details
Fromsrc/analytics.ts:250-319:
Privacy Considerations
Disabling for Specific Pages
You can conditionally enable heatmap tracking:Troubleshooting
Events Not Appearing in Dashboard
- Verify
enableHeatmapTracking: truein config - Check browser console for errors (enable
debug: true) - Ensure events are being flushed (check queue size)