AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

querying-posthog-data

Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.information_schema.metrics for an approved definition. Examples include MRR, activation, billable usage, active organizations, and failure rates. Use the approved definition before you derive a measure from raw events or use a typed domain tool. It also covers HogQL differences, system table schemas, functions, query examples, and schema discovery.

Original source
posthog
License
MIT
Pinned revision
cac7c80a9e5b73484d18eda1bffb47297c938e0c

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read posthog--querying-posthog-data at revision cac7c80a9e5b73484d18eda1bffb47297c938e0c, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 65

references/models-hog-functions.md

Hog Functions

Hog Function (system.hog_functions)

Hog functions are programmable event handlers in PostHog's CDP (Customer Data Platform). They process events in real time to send data to external destinations, transform events during ingestion, or run site-side apps.

Function Types

  • destination — sends event data to external services (Slack, webhooks, CRMs, etc.)
  • site_destination — client-side destination running in the browser
  • internal_destination — PostHog internal processing (e.g. triggering workflows)
  • source_webhook — receives inbound webhooks and converts them to PostHog events
  • warehouse_source_webhook — receives webhooks for data warehouse ingestion
  • site_app — client-side app running in the browser (e.g. surveys, feedback widgets)
  • transformation — modifies events during ingestion before they reach ClickHouse

Columns

Column | Type | Nullable | Description --- | --- | --- | --- id | String | NOT NULL | Function UUID. team_id | Integer | NOT NULL | name | String | NOT NULL | Function name. description | String | NOT NULL | Function description. type | String | NOT NULL | Function type, e.g. 'destination', 'transformation', 'site_app'. enabled | Integer | NOT NULL | 1 if the function is enabled, 0 otherwise. deleted | Integer | NOT NULL | 1 if the function has been deleted, 0 otherwise. icon_url | String | NOT NULL | URL of the function's icon. template_id | String | NOT NULL | Id of the template this function was created from. execution_order | Integer | NOT NULL | Order in which the function runs relative to others of its type. inputs_schema | JSON | NOT NULL | JSON schema describing the function's configurable inputs. filters | JSON | NOT NULL | JSON filters deciding which events the function runs on. created_at | DateTime | NOT NULL | When the function was created. updated_at | DateTime | NOT NULL | When the function was last updated.

Query Examples

-- List all enabled destinations
SELECT id, name, template_id, updated_at
FROM system.hog_functions
WHERE type = 'destination' AND enabled = 1 AND deleted = 0
ORDER BY updated_at DESC

-- Count functions by type
SELECT type, count() AS total
FROM system.hog_functions
WHERE deleted = 0
GROUP BY type
ORDER BY total DESC

-- List transformations in execution order
SELECT id, name, execution_order, enabled
FROM system.hog_functions
WHERE type = 'transformation' AND deleted = 0
ORDER BY execution_order ASC

-- Find functions created from a specific template
SELECT id, name, enabled, created_at
FROM system.hog_functions
WHERE template_id = 'template-slack' AND deleted = 0

-- Find functions updated in the last 7 days
SELECT id, name, type, updated_at
FROM system.hog_functions
WHERE updated_at > now() - toIntervalDay(7) AND deleted = 0
ORDER BY updated_at DESC