Skip to main content

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
All data includes viewport dimensions and element selectors for accurate replay and visualization.

Setup

1

Enable in Configuration

Set enableHeatmapTracking: true when initializing the SDK:
2

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
3

View in Dashboard

Access heatmap visualizations in your MentiQ dashboard to see:
  • Click density maps showing hotspots
  • Mouse movement trails
  • Scroll depth analytics
  • Element engagement rates

Data Structure

Each heatmap event includes:

Manual Tracking with Components

For more control, use the HeatmapTracker 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

From src/analytics.ts:250-319:

Privacy Considerations

Heatmap tracking captures user interaction patterns. Ensure compliance with privacy regulations:
  • Inform users about heatmap tracking in your privacy policy
  • Consider disabling on pages with sensitive information
  • Respect user opt-out preferences

Disabling for Specific Pages

You can conditionally enable heatmap tracking:

Troubleshooting

Events Not Appearing in Dashboard

  1. Verify enableHeatmapTracking: true in config
  2. Check browser console for errors (enable debug: true)
  3. Ensure events are being flushed (check queue size)

Too Much Data

Increase debounce intervals or reduce tracking scope: