Heatmaps

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
GET
GET
GET

List all environments 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).

Required API key scopes

heatmap:read

Query parameters

  • aggregation
    string
    Default: total_count
    One of: "unique_visitors""total_count"
  • cohort_ids
    stringnull
  • date_from
    string
    Default: -7d
  • date_to
    string
  • filter_test_accounts
    booleannull
  • hide_zero_coordinates
    boolean
    Default: true
  • type
    string
    Default: click
  • url_exact
    string
  • url_pattern
    string
  • viewport_width_max
    integer
  • viewport_width_min
    integer

Example request

GET /api/environments/:environment_id/heatmaps
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/heatmaps/

Example response

Status 200
RESPONSE
{
"results": [
{
"count": 0,
"pointer_y": 0,
"pointer_relative_x": 0.1,
"pointer_target_fixed": true
}
],
"fold": {
"total_count": 0,
"below_fold_count": 0,
"pct_below_fold": 0.1,
"median_viewport_height": 0
}
}

Retrieve environments heatmaps events

Drill into the individual session interactions behind one or more heatmap coordinates. Pass the 'points' you want to inspect (from the heatmaps list response) to get the underlying per-session events, so you can jump to the session recordings that produced a hotspot.

Required API key scopes

heatmap:read

Query parameters

  • aggregation
    string
    Default: total_count
    One of: "unique_visitors""total_count"
  • cohort_ids
    stringnull
  • date_from
    string
    Default: -7d
  • date_to
    string
  • filter_test_accounts
    booleannull
  • hide_zero_coordinates
    boolean
    Default: true
  • limit
    integer
    Default: 50
  • offset
    integer
    Default: 0
  • points
    string
  • type
    string
    Default: click
  • url_exact
    string
  • url_pattern
    string
  • viewport_width_max
    integer
  • viewport_width_min
    integer

Response


Example request

GET /api/environments/:environment_id/heatmaps/events
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/heatmaps/events/

Example response

Status 200
RESPONSE
{
"results": [
{
"session_id": "string",
"distinct_id": "string",
"timestamp": "2019-08-24T14:15:22Z",
"pointer_relative_x": 0.1,
"pointer_y": 0,
"current_url": "string",
"type": "string"
}
],
"total_count": 0,
"has_more": true
}

List all 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).

Required API key scopes

heatmap:read

Query parameters

  • aggregation
    string
    Default: total_count
    One of: "unique_visitors""total_count"
  • cohort_ids
    stringnull
  • date_from
    string
    Default: -7d
  • date_to
    string
  • filter_test_accounts
    booleannull
  • hide_zero_coordinates
    boolean
    Default: true
  • type
    string
    Default: click
  • url_exact
    string
  • url_pattern
    string
  • viewport_width_max
    integer
  • viewport_width_min
    integer

Example request

GET /api/projects/:project_id/heatmaps
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/heatmaps/

Example response

Status 200
RESPONSE
{
"results": [
{
"count": 0,
"pointer_y": 0,
"pointer_relative_x": 0.1,
"pointer_target_fixed": true
}
],
"fold": {
"total_count": 0,
"below_fold_count": 0,
"pct_below_fold": 0.1,
"median_viewport_height": 0
}
}

Retrieve heatmaps events

Drill into the individual session interactions behind one or more heatmap coordinates. Pass the 'points' you want to inspect (from the heatmaps list response) to get the underlying per-session events, so you can jump to the session recordings that produced a hotspot.

Required API key scopes

heatmap:read

Query parameters

  • aggregation
    string
    Default: total_count
    One of: "unique_visitors""total_count"
  • cohort_ids
    stringnull
  • date_from
    string
    Default: -7d
  • date_to
    string
  • filter_test_accounts
    booleannull
  • hide_zero_coordinates
    boolean
    Default: true
  • limit
    integer
    Default: 50
  • offset
    integer
    Default: 0
  • points
    string
  • type
    string
    Default: click
  • url_exact
    string
  • url_pattern
    string
  • viewport_width_max
    integer
  • viewport_width_min
    integer

Response


Example request

GET /api/projects/:project_id/heatmaps/events
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/heatmaps/events/

Example response

Status 200
RESPONSE
{
"results": [
{
"session_id": "string",
"distinct_id": "string",
"timestamp": "2019-08-24T14:15:22Z",
"pointer_relative_x": 0.1,
"pointer_y": 0,
"current_url": "string",
"type": "string"
}
],
"total_count": 0,
"has_more": true
}

Community questions

Questions about this page? or post a community question.