Heatmap Architecture
Complete data flow from user interaction to visualization with full session replay integration
๐ Data Flow Architecture
Captures interactions
100KB or 10s batches
Stores raw events
heatmap_data
๐ป SDK Configuration
rrweb Recording Settings
The SDK uses rrweb library to capture user interactions with optimized sampling
// recorder.ts - rrweb configuration
const recordingConfig = {
mousemove: 50, // Sample every 50ms during movement
scroll: 150, // Sample every 150ms (throttled)
mouseInteraction: true // Capture all clicks (100%)
};
// Events captured:
// - MouseInteraction.Click โ click coordinates
// - MouseMove โ position arrays
// - Scroll โ y-offset values
// - Viewport + screen size metadataAggregation Pipeline
Raw events are processed into aggregated heatmap data
// heatmapAggregator.ts - data processing
const aggregation = {
source: 'replay_chunks',
groupBy: 'hostname|urlPattern|deviceType',
binning: {
xPercent: 1, // 1% increments (0-100)
yAbsolute: 10, // 10px increments
scrollDepth: 5 // 5% increments
}
};
// Output: heatmap_data table
// Engine: SummingMergeTree()
// Auto-sums 'count' on mergeโ๏ธ Processing Pipeline
1. SDK Capture
rrweb library recording
Clicks, moves, scrolls, viewport2. Aggregation
Parse raw rrweb JSON
xPercent, yAbsolute, binning3. ClickHouse
SummingMergeTree storage
Auto-sum counts, 1yr TTL4. Frontend
Canvas rendering
Radial gradients, overlay๐จ Canvas Rendering Algorithm
1. Draw Density Map
For each point, draw a radial gradient circle with alpha proportional to interaction count. Overlapping circles build up density.
2. Color Mapping
Read each pixel's alpha value. Use it as index into 256-color gradient palette (blueโgreenโyellowโred).
3. Composite Overlay
Overlay the colored heatmap on an iframe showing the actual website. Filter by device type and interaction type.
4. Device Widths
Responsive rendering at 375px (mobile), 768px (tablet), and 1280px (desktop) viewport widths.
๐ Competitor Comparison
| Feature | Claymore | Hotjar | MS Clarity | FullStory |
|---|---|---|---|---|
| Click Heatmap | โ Yes | โ Yes | โ Yes | โ Yes |
| Scroll Heatmap | Data only | โ Visual | โ Visual | โ Visual |
| Mouse Movement | โ Yes | โ Yes | โ No | โ Yes |
| Session Replay | โ Integrated | โ Yes | โ Yes | โ Yes |
| Rage Click Detection | โ No | โ Yes | โ Yes | โ Yes |
| Element Attribution | Coords only | โ CSS Selectors | โ CSS Selectors | โ CSS Selectors |
| Self-Hosted Option | โ Full | โ SaaS only | โ SaaS only | โ SaaS only |
| Data Ownership | โ 100% | Shared | Microsoft | Shared |
| Pricing | Self-hosted | $32-171/mo | Free | $199+/mo |
| Real-time Processing | Job-based | โ Near RT | โ Near RT | โ Near RT |
๐ What We Have & What's Coming
โ Available Now
- Full session replay integration
- Click and mouse movement heatmaps
- Self-hosted with complete data ownership
- Proven rrweb library (industry standard)
- Efficient ClickHouse SummingMergeTree
- URL pattern normalization
- Device-type segmentation
- Absolute Y positioning (document coords)
๐ Coming Soon
- Automatic scheduled aggregation
- Element-based click tracking (CSS selectors)
- Rage click detection
- Scroll depth visualization
- Dead click analysis
- A/B test segmentation
- AI-powered insights
- Real-time heatmap streaming