posthog-analytics

Automate PostHog dashboard creation, sync, update, and export via the PostHog API.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/lsongdev/skills --skill posthog-analytics-lsongdev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: posthog-analytics
Source: https://github.com/lsongdev/skills/tree/main/posthog-analytics
Command: npx skills add https://github.com/lsongdev/skills --skill posthog-analytics-lsongdev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires curl, jq, and includes scripts (resource) components.

What problem does it solve? Manually building and maintaining PostHog dashboards through the UI is repetitive and hard to version-control. This Skill lets you define dashboards as JSON config files and create, sync, update, or export them through the PostHog API. ## Core Features & Use Cases - Config-driven dashboards: Define dashboards and insights (pageviews, unique users, traffic trends, top pages) in a version-controlled JSON file. - Four CLI commands: create builds a new dashboard, sync adds only new insights, update rewrites existing insights with new filters, and export dumps an existing dashboard back to JSON. - Use Case: You run a blog and want consistent analytics. Write a blog_dashboard.json config with a source=blog filter, run the create command, and get a live PostHog dashboard URL with all insights configured. ## Quick Start Set your POSTHOG_PERSONAL_API_KEY environment variable, then ask the agent to create a PostHog dashboard from a JSON config using the posthog_sync.sh script.

Frequently Asked Questions about posthog-analytics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a PostHog dashboard from a config file?▼

Write a JSON config with a name, optional filter, and an insights array, then run `./scripts/posthog_sync.sh create config.json`. The script creates the dashboard via the PostHog API, adds all insights, and writes the dashboard_id back into your config.

How do I add new insights to an existing PostHog dashboard?▼

Add the new insight objects to your config file and run `./scripts/posthog_sync.sh sync config.json`. Sync only creates insights whose names do not already exist on the dashboard; existing ones are skipped.

What API key does the PostHog sync script need?▼

It requires a PostHog personal API key exported as POSTHOG_PERSONAL_API_KEY, created under PostHog Settings with read/write access. The key determines your organization and project via the @current project context.

Does the PostHog sync script work with EU PostHog instances?▼

Yes. Set POSTHOG_HOST to eu.i.posthog.com and POSTHOG_UI_HOST to eu.posthog.com. By default the script targets the US hosts us.i.posthog.com and us.posthog.com.

What is the difference between sync and update in posthog_sync.sh?▼

Sync only creates new insights and skips existing ones matched by name. Update patches all existing insights with the current config's filters and settings, creating any that are missing.