heatmaps

Aggregated heatmap interactions for a page. For type 'click'/'rageclick'/'mousemove' each result is a point with relative x, absolute client-y, and a count. For type 'scrolldepth' the response is scroll-depth buckets instead (cumulative reach down the page).

get/api/projects/{project_id}/heatmaps/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/heatmaps/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

aggregation'unique_visitors' | 'total_count'

How to aggregate counts: 'total_count' (every interaction, default) or 'unique_visitors' (distinct people).

  • unique_visitors - unique_visitors
  • total_count - total_count
cohort_idsstring nullable

JSON array of cohort IDs (e.g. '[123, 456]') to restrict results to people in those cohorts. Feature-flagged; ignored when the cohort filter is not enabled for the caller.

date_fromstring

Start of the window. Relative (e.g. '-7d', '-30d', '-1mStart') or an absolute 'YYYY-MM-DD' date. Defaults to '-7d'. Heatmap data is retained for 90 days.

date_tostring

End of the window, inclusive. Relative or absolute 'YYYY-MM-DD'. Defaults to today.

eventsstring nullable

JSON array of event filters (e.g. '[{"id": "purchase", "properties": []}]') to restrict results to sessions in which those events occurred. Each entry needs a string 'id' (the event name) and may carry a 'properties' array of property filters applied to that event, each of type 'event' or 'element'. Several entries are combined with AND: the session must contain a matching event for every entry. At most 10 entries, each with at most 20 property filters. Requires project-wide heatmap access, since the filter reads the project's events rather than one saved heatmap. Feature-flagged; ignored when the event filter is not enabled for the caller.

filter_test_accountsboolean nullable

When true, exclude sessions from internal/test accounts using the project's test-account filters.

hide_zero_coordinatesboolean

When true (default), drop interactions recorded at the (0, 0) origin, which are usually noise.

limitinteger

Maximum number of coordinate points to return, ordered hottest-first by count. Defaults to 500. Pass 0 to fetch the full set (every coordinate) needed to render a complete heatmap overlay. Ignored for the 'scrolldepth' type, which always returns every bucket.

offsetinteger

Number of hottest-first points to skip, for paging through cooler coordinates. Ignored for the 'scrolldepth' type.

timestamp_fromstring date-time

Inclusive UTC instant. Supply with timestamp_to to override date bounds.

timestamp_tostring date-time

Exclusive UTC instant. Supply with timestamp_from to override date bounds.

typestring

The interaction type to return. One of: 'click' (default), 'rageclick', 'mousemove', or 'scrolldepth'. Scrolldepth returns scroll buckets instead of x/y coordinates.

url_exactstring

Match a single page by exact URL (trailing slash is ignored). Mutually exclusive with url_pattern.

url_patternstring

Match pages by regex against the full current_url (anchored automatically). Use this to aggregate across query strings or path segments. Mutually exclusive with url_exact.

viewport_width_maxinteger

Only include interactions captured at a viewport at most this wide, in CSS pixels.

viewport_width_mininteger

Only include interactions captured at a viewport at least this wide, in CSS pixels. Use with viewport_width_max to isolate a device class (e.g. 360-768 for mobile).

Response

has_moreboolean

True when more coordinate points exist beyond the returned page. Raise 'limit' or page with 'offset' to fetch them. Always false for scrolldepth, which returns every bucket.

Changes

No recorded changes to this operation across all 1 revision of this API.