provider elements GET /api/environments/{environment_id}/elements/stats/
@utdk/posthog /api/environments/{environment_id}/elements/stats/
environments_elements_stats_retrieve
Counts of $autocapture, $rageclick, and $dead_click events grouped by the element chain they occurred on, ordered by count. Defaults to all three event types; narrow with the include parameter.
data_attributes query
Comma-separated data attribute names (wildcards allowed, e.g. data-*). When provided, each element's attributes map is filtered to matching attr__* keys, shrinking the response.
string
date_from query
Start of the date range (e.g. -7d, 2024-01-01). Defaults to last 7 days.
string
date_to query
End of the date range (e.g. 2024-01-31). Defaults to now.
string
environment_id path required
Deprecated. Use /api/projects/{project_id}/ instead.
string
filter_test_accounts query
When true, applies the project's internal-and-test-account filters to the underlying events. Pass the lowercase string true; other truthy spellings are ignored.
boolean
include query
Event types to include: $autocapture, $rageclick, $dead_click. Defaults to all three. Accepts repeated parameters, a JSON array, or a comma-separated list.
array
limit query
Maximum rows per page
integer
offset query
Pagination offset
integer
properties query
JSON-encoded list of property filters to apply to the underlying events, e.g. [{"key": "$current_url", "value": "https://example.com/page"}] or [{"key": "email", "value": "@posthog.com", "operator": "icontains", "type": "person"}]. Supports event, person, cohort, element, and HogQL property filter types.
string
sampling_factor query
Sampling factor between 0 and 1
number

Try it

Authentication
Configure credentials for PostHog API
environmentsElementsStatsRetrieve
GET/api/environments/{environment_id}/elements/stats/
Counts of $autocapture, $rageclick, and $dead_click events grouped by the element chain they occurred on, ordered by count. Defaults to all three event types; narrow with the include parameter.

Parameters

required

Deprecated. Use /api/projects/{project_id}/ instead.

Comma-separated data attribute names (wildcards allowed, e.g. data-*). When provided, each element's attributes map is filtered to matching attr__* keys, shrinking the response.

Start of the date range (e.g. -7d, 2024-01-01). Defaults to last 7 days.

End of the date range (e.g. 2024-01-31). Defaults to now.

When true, applies the project's internal-and-test-account filters to the underlying events. Pass the lowercase string true; other truthy spellings are ignored.

Event types to include: $autocapture, $rageclick, $dead_click. Defaults to all three. Accepts repeated parameters, a JSON array, or a comma-separated list.

Maximum rows per page

Pagination offset

JSON-encoded list of property filters to apply to the underlying events, e.g. [{"key": "$current_url", "value": "https://example.com/page"}] or [{"key": "email", "value": "@posthog.com", "operator": "icontains", "type": "person"}]. Supports event, person, cohort, element, and HogQL property filter types.

Sampling factor between 0 and 1

Configure credentials above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import posthog from '@utdk/posthog';

await posthog.environmentsElementsStatsRetrieve()