Mixpanel
How to Build

Building Heatmaps at scale

Article details
Last Edited:
Dec 1, 2026
Published:
Aug 15, 2025

Pixels or DOM elements? Why not both?

Article image
Article image

From individual sessions to aggregate insights

Building on giants: Session Replay + Autocapture

A 256-character limit and three coordinate systems

Challenge 1: The query limits problem

The $elements property
JSON
"$elements": [
  {
    "$classes": [
      "add-button"
    ],
    "$nth_child": 1,
    "$nth_of_type": 1,
    "$tag_name": "button"
  },
  {
    "$classes": [
      "button-container"
    ],
    "$nth_child": 1,
    "$nth_of_type": 1,
    "$tag_name": "div"
  },
  // more ancestors...
  {
    "$classes": [
      "mobile-optimized",
      "new-chrome"
    ],
    "$nth_child": 2,
    "$nth_of_type": 1,
    "$tag_name": "body"
  }
]
Custom Property display formula
JavaScript
displayFormula = `$elements[${index}]["$tag_name"], $elements[${index}]["$id"], $elements[${index}]["$classes"]`

Challenge 2: The multi-coordinate system problem

Article image

Challenge 3: Choosing the right visualization

Article image

From raw events to interactive visualizations

The future of Heatmaps

Join us in solving these challenges

Share article