heatmap

package
v0.66.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package heatmap turns autocaptured $click events into a click-density grid for a page, plus the top clicked elements — computed at query time over the existing events, no new stored config and no screenshots. The engine only ever emits integer coordinates; any page image is an iframe rendered browser-side in the cloud app, never here (a static Go binary ships no headless browser).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Row int `json:"row"`
	Col int `json:"col"`
	N   int `json:"n"`
}

Cell is one grid bucket: Row (docY / row_px), Col (0..cols-1), and N clicks in it.

type Result

type Result struct {
	Path       string   `json:"path"`
	Viewport   string   `json:"viewport"`
	Cols       int      `json:"cols"`
	RowPx      int      `json:"row_px"`
	Clicks     int      `json:"clicks"`  // total positioned clicks counted
	Max        int      `json:"max"`     // busiest cell (for canvas scaling)
	MaxRow     int      `json:"max_row"` // tallest row index seen (grid height)
	Cells      []Cell   `json:"cells"`
	TopTargets []Target `json:"top_targets"`
	Note       string   `json:"note,omitempty"`
}

Result is the heatmap for one page + viewport bucket.

func Compute

func Compute(evs []event.Event, path, viewport string, cols, rowPx int) Result

Compute aggregates $click events on `path` into a density grid. viewport is ""/"all"/"mobile"/ "tablet"/"desktop" (bucketed by the captured viewport width). cols/rowPx default to 40/20. Pure and deterministic — cells and targets are emitted in a stable sort order — so /v1/heatmap and the MCP heatmap tool agree byte-for-byte, the same contract as every other report.

type Target

type Target struct {
	Label string `json:"label"`
	N     int    `json:"n"`
}

Target is a clicked element rolled up by a stable label, most-clicked first.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL