Heatmap Architecture

Complete data flow from user interaction to visualization with full session replay integration

50ms
Mouse Sampling
150ms
Scroll Sampling
10s
Flush Interval
100KB
Max Payload
5s
Job Polling

๐Ÿ“Š Data Flow Architecture

๐ŸŒSDK + rrweb
Customer's website
Captures interactions
๐Ÿ“ฆTransport
Buffers events
100KB or 10s batches
๐ŸšขAPI /sdk/ingest
Receives chunks
Stores raw events
ClickHouse
replay_chunks โ†’
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 metadata

Aggregation 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, viewport

2. Aggregation

Parse raw rrweb JSON

xPercent, yAbsolute, binning

3. ClickHouse

SummingMergeTree storage

Auto-sum counts, 1yr TTL

4. 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

FeatureClaymoreHotjarMS ClarityFullStory
Click Heatmapโœ“ Yesโœ“ Yesโœ“ Yesโœ“ Yes
Scroll HeatmapData onlyโœ“ Visualโœ“ Visualโœ“ Visual
Mouse Movementโœ“ Yesโœ“ Yesโœ— Noโœ“ Yes
Session Replayโœ“ Integratedโœ“ Yesโœ“ Yesโœ“ Yes
Rage Click Detectionโœ— Noโœ“ Yesโœ“ Yesโœ“ Yes
Element AttributionCoords onlyโœ“ CSS Selectorsโœ“ CSS Selectorsโœ“ CSS Selectors
Self-Hosted Optionโœ“ Fullโœ— SaaS onlyโœ— SaaS onlyโœ— SaaS only
Data Ownershipโœ“ 100%SharedMicrosoftShared
PricingSelf-hosted$32-171/moFree$199+/mo
Real-time ProcessingJob-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