Loading...
Loading...
Automate PostHog dashboard creation, sync, update, and export via API
npx skill4agent add sylphai-inc/skills posthog-analyticscurljqbrew install jqapt install jqbashexport POSTHOG_PERSONAL_API_KEY=phx_xxx@current# Test your API key - should return your project info
curl -s -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
"https://us.i.posthog.com/api/projects/@current/" | jq '{id, name}'{
"id": 209268,
"name": "Default project"
}blog_dashboard.json{
"name": "Blog Analytics",
"description": "Track blog performance and reader engagement",
"filter": {"key": "source", "value": "blog"},
"dashboard_id": null,
"insights": [
{"name": "Blog Pageviews (Total)", "type": "pageviews_total"},
{"name": "Unique Blog Readers", "type": "unique_users"},
{"name": "Blog Traffic Trend", "type": "traffic_trend"},
{"name": "Top Blog Posts", "type": "top_pages"}
]
}dashboard_id: null./scripts/posthog_sync.sh create blog_dashboard.jsonCreating dashboard: Blog Analytics
Dashboard created: ID 1166599
Creating insight: Blog Pageviews (Total)
{id: 6520531, name: "Blog Pageviews (Total)"}
...
Dashboard URL: https://us.posthog.com/project/209268/dashboard/11665991166599209268dashboard_id./scripts/posthog_sync.sh sync blog_dashboard.json./scripts/posthog_sync.sh update blog_dashboard.json./scripts/posthog_sync.sh export 1166599 > exported_dashboard.json| Field | Required | Description |
|---|---|---|
| Yes | Dashboard name |
| No | Dashboard description |
| No* | Event property filter: |
| No* | URL filter fallback: |
| No | Set to |
| Yes | Array of insight objects |
filterdomain_filter| Type | Display | Description |
|---|---|---|
| BoldNumber | Total pageview count |
| BoldNumber | Unique visitors (DAU) |
| LineGraph | Traffic over time |
| Table | Top pages breakdown |
| Field | Default | Options |
|---|---|---|
| | |
| Auto | |
| | |
| Variable | Required | Default | Description |
|---|---|---|---|
| Yes | - | Your API key (determines org/project) |
| No | us.i.posthog.com | API host (EU: eu.i.posthog.com) |
| No | us.posthog.com | UI host for dashboard URLs |
scripts/posthog_sync.shexamples/blog_dashboard.json