| name | posthog-cost-tuning |
| description | Optimize PostHog costs: autocapture tuning, event sampling with before_send,
bot filtering, session recording sampling, and billing monitoring.
Trigger: "posthog cost", "posthog billing", "reduce posthog costs",
"posthog pricing", "posthog expensive", "posthog budget", "posthog free tier".
|
| allowed-tools | Read, Grep |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","posthog","api","monitoring","cost-optimization"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
PostHog Cost Tuning
Overview
PostHog Cloud pricing is event-based: 1M events/month free, then usage-based pricing beyond that. Session recordings, feature flag evaluations, and surveys each have their own free tiers. The biggest cost drivers are typically $autocapture events, $pageview on high-traffic pages, and bot traffic. This skill covers specific techniques to reduce event volume without losing analytical value.
Prerequisites
- PostHog Cloud account with billing access
- Application instrumented with posthog-js
- Understanding of which events drive your analytics
PostHog Cloud Free Tiers (2025)
| Product | Free Tier | Overage |
|---|
| Product analytics | 1M events/month | ~$0.00031/event |
| Session recordings | 5K sessions/month | ~$0.04/session |
| Feature flags | 1M API requests/month | ~$0.0001/request |
| Surveys | 250 responses/month | ~$0.10/response |
Instructions
Step 1: Audit Current Event Volume
set -euo pipefail
curl "https://app.posthog.com/api/projects/$POSTHOG_PROJECT_ID/query/" \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": {
"kind": "HogQLQuery",
"query": "SELECT event, count() AS total FROM events WHERE timestamp > now() - interval 30 day GROUP BY event ORDER BY total DESC LIMIT 20"
}
}' | jq '.results[] | {event: .[0], count: .[1]}'
Step 2: Tune Autocapture
$autocapture is often the largest event volume. Restrict it to only useful interactions.
import posthog from 'posthog-js';
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
: ,
: {
: [, ],
: [, , , ],
: [, ],
: [, , , ],
},
});