Overview
TheHeatmapTracker component captures detailed interaction data including clicks, hovers, and scrolls within a specific element. This data can be used to generate heatmaps showing user behavior patterns.
Props
The content to render and track interactions for.
Whether to track click interactions within the element.
Whether to track when users hover over the element.
Whether to track scroll events and element visibility.
Identifier for the tracked element used in analytics events.
Usage
Track Clicks Only
Track All Interactions
Track Hover Behavior
Tracked Events
Click Events (heatmap_click)
Tracked when trackClicks is enabled:
element- Element identifierx- X coordinate relative to elementy- Y coordinate relative to elementpage_x- X coordinate relative to viewportpage_y- Y coordinate relative to viewportelement_width- Width of the tracked elementelement_height- Height of the tracked element
Hover Events
Tracked whentrackHovers is enabled:
heatmap_hover_start- When mouse enters the elementheatmap_hover_end- When mouse leaves the element
Scroll Events (heatmap_scroll)
Tracked when trackScrolls is enabled:
element- Element identifierscroll_top- Current scroll positionelement_top- Element’s position from top of pageelement_visible- Whether element is currently visible
Behavior
- Wraps children in a
<div>element with event listeners - All event listeners use passive mode for better performance
- Automatically cleans up all listeners on unmount
- Click coordinates are calculated relative to element bounds
- Scroll tracking uses window scroll events
Use Cases
- Generate click heatmaps for landing pages
- Analyze user attention with hover tracking
- Understand scroll behavior and content visibility
- Optimize page layouts based on interaction patterns
- Identify dead zones with low engagement
- A/B test different UI arrangements