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/taxonomy-dynamic-properties.md

Dynamic person and event properties

Some properties follow dynamic naming patterns with IDs or keys. These are not returned by the read-data-schema tool because they are generated per survey, feature flag, or product tour. If a user's question involves these features, construct the property name using the patterns below.

Person properties

Pattern | Type | Description $survey_dismissed/{survey_id} | Boolean | Whether a person dismissed a specific survey $survey_responded/{survey_id} | Boolean | Whether a person responded to a specific survey $feature_enrollment/{flag_key} | Boolean | Whether a person opted into an early access feature $feature_interaction/{feature_key} | Boolean | Whether a person interacted with a specific feature $product_tour_dismissed/{tour_id} | Boolean | Whether a person dismissed a product tour $product_tour_shown/{tour_id} | Boolean | Whether a person was shown a product tour $product_tour_completed/{tour_id} | Boolean | Whether a person completed a product tour

Event properties

Pattern | Type | Description $feature/{flag_key} | String | The feature flag value for a specific flag

Querying dynamic properties with SQL

Because these properties are not discoverable via the read-data-schema tool, you must know the ID or key. Use these queries to find the IDs, then construct the property name.

Find survey IDs

SELECT id, name, type
FROM system.surveys
ORDER BY created_at DESC
LIMIT 20

Then query person properties like $survey_dismissed/{id} or $survey_responded/{id}.

Find feature flag keys

SELECT id, key, name, rollout_percentage
FROM system.feature_flags
WHERE NOT deleted
ORDER BY created_at DESC
LIMIT 20

Then query event properties like $feature/{key} or person properties like $feature_enrollment/{key}.

Find early access features

SELECT id, name, feature_flag_id
FROM system.early_access_features
ORDER BY created_at DESC
LIMIT 20

Then look up the flag key and query $feature_enrollment/{flag_key}.

Event taxonomy omit list

The read-data-schema tool's event property results automatically filter out these dynamic patterns (and other noisy properties) to keep results clean:

Pattern | Reason $feature/{flag_key} | Feature flag values — one per flag, high cardinality $feature_enrollment/{flag_key} | Early access enrollment — dynamic per flag $feature_interaction/{feature_key} | Feature interaction tracking — dynamic per feature $product_tour_* | Product tour lifecycle — dynamic per tour survey_dismiss*, survey_responded* | Survey tracking — dynamic per survey $set, $set_once | Person property setting, not analytics properties $ip | Privacy-related __* | Flatten-properties-plugin artifacts phjs* | Internal SDK metadata