Sub topic 2
How scanning is measured: fixations, saccades and heatmaps
This chapter assumes you know basic HTML and CSS and the common page parts (header, navigation, hero section, call to action). It also assumes you have read the previous chapter on why people scan instead of read. Claims about "where people look" come from measurements, and you need to know how those measurements work before you can judge them.
What an eye tracker records
An eye tracker is a camera plus software that estimates where on the screen a person is looking. It records gaze samples, which are triples of time, x position and y position. Lab devices sample at 60 Hz to over 1000 Hz. Webcam-based tools are cheaper but less accurate.
Raw samples are not useful on their own. Researchers group them into two kinds of events.
| Term | What it is | Typical duration | Why it matters |
|---|---|---|---|
| Fixation | The eye rests on one spot and takes in detail | About 200 to 300 ms | Counts as "looking at" something |
| Saccade | A fast jump between fixations | About 20 to 40 ms | Little is processed during the jump |
| Gaze path (scanpath) | The ordered sequence of fixations and saccades | Whole visit | Shows reading order |
Scanning a page is a chain of fixations joined by saccades. A scan that skips most of the text shows up as few fixations on paragraphs and many on headings, images and buttons.
Turning samples into fixations
A common method is dispersion-threshold identification (I-DT). If consecutive samples stay within a small area for at least a minimum time, they form a fixation. The script below applies this to a tiny made-up recording and then builds a heatmap as a grid of summed fixation time.
def dispersion(points):
xs = [p[1] for p in points]
ys = [p[2] for p in points]
return (max(xs) - min(xs)) + (max(ys) - min(ys))
def find_fixations(samples, max_dispersion=35, min_duration=100):
"""samples: list of (time_ms, x_px, y_px).
Returns a list of (start_ms, duration_ms, x, y)."""
fixations = []
i, n = 0, len(samples)
while i < n:
j = i
while j < n and samples[j][0] - samples[i][0] < min_duration:
j += 1
if j >= n:
break
if dispersion(samples[i:j + 1]) <= max_dispersion:
while j + 1 < n and dispersion(samples[i:j + 2]) <= max_dispersion:
j += 1
window = samples[i:j + 1]
cx = sum(p[1] for p in window) / len(window)
cy = sum(p[2] for p in window) / len(window)
fixations.append((window[0][0], window[-1][0] - window[0][0], cx, cy))
i = j + 1
else:
i += 1
return fixations
def make_samples():
# One sample every 20 ms (50 Hz). Each tuple is (x, y, dwell in ms).
samples, t = [], 0
for x, y, ms in [(100, 50, 300), (500, 55, 260), (110, 200, 240)]:
for k in range(ms // 20):
samples.append((t, x + k % 3, y + k % 2))
t += 20
return samples
def heatmap(fixations, cell=100):
grid = {}
for _, duration, x, y in fixations:
key = (int(x // cell), int(y // cell))
grid[key] = grid.get(key, 0) + duration
return grid
fixations = find_fixations(make_samples())
for start, duration, x, y in fixations:
print(f"fixation at {start} ms, {duration} ms long, near ({x:.0f}, {y:.0f})")
print(sorted(heatmap(fixations).items()))The script finds three fixations of 280, 240 and 220 ms. The jumps between them fall between samples, which stands in for the saccades. The grid keys are (column, row) cells of 100 px.
Reading a heatmap
A heatmap overlays color on a page screenshot. Warm colors mark places that collected many fixations or a lot of total fixation time, and cool colors mark places that got little. A heatmap is an aggregate. Many participants are merged, so no single person looked exactly like the picture.
The F-pattern is a heatmap shape. Red bands along the top and left edge of a text page, with a shorter second band, look like the letter F. The shape appears only after combining many scanpaths.
What to check before trusting a heatmap
- The task. Participants told to find a price look differently from participants browsing freely.
- The metric. Fixation count, total fixation time and time to first fixation answer different questions.
- The sample size. A heatmap from five people can change a lot when a sixth joins.
- The color scale. Tools set "red" relative to the busiest spot on that page. Two heatmaps with different scales are not directly comparable.
- Accuracy. Gaze estimates have an error of roughly a degree of visual angle, so small elements packed close together blur.
- What it cannot say. A fixation shows that someone looked, not that they understood, liked or noticed the content in a useful way.
Exercise
A heatmap of a pricing page shows a hot red area on a decorative photo and a cool area on the "Buy" button. A teammate says the photo is working and the button is fine to leave. Give two reasons to be cautious, and say what you would check next.
Show answer
Fixations show only that people looked, not that the look was useful. A photo can attract long fixations because it is hard to interpret or distracting, which draws attention away from the button. Also, heatmap colors depend on the scale and the task. People who already decided to buy may find the button with one short fixation, which looks cool but works. Next, check the metric (total time versus time to first fixation), the sample size and the task given to participants, and compare with click data or the completion rate of the purchase step.