Deploy PostHog integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying PostHog-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy posthog", "posthog Vercel", "posthog production deploy", "posthog Cloud Run", "posthog Fly.io".
From posthog-packnpx claudepluginhub nickloveinvesting/nick-love-plugins --plugin posthog-packThis skill is limited to using the following tools:
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Deploy PostHog analytics integration to production. Covers client-side snippet deployment, server-side event capture with posthog-node, reverse proxy setup to avoid ad blockers, and self-hosted PostHog deployment using Docker.
phc_)// lib/posthog.ts
import posthog from "posthog-js";
export function initPostHog() {
if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://us.i.posthog.com",
capture_pageview: false, // Manual pageview tracking
loaded: (posthog) => {
if (process.env.NODE_ENV === "development") posthog.debug();
},
});
}
}
// lib/posthog-server.ts
import { PostHog } from "posthog-node";
const posthog = new PostHog(process.env.POSTHOG_API_KEY!, {
host: process.env.POSTHOG_HOST || "https://us.i.posthog.com",
});
export async function trackServerEvent(
distinctId: string,
event: string,
properties?: Record<string, any>
) {
posthog.capture({ distinctId, event, properties });
await posthog.flush();
}
// next.config.js - Proxy PostHog through your domain
module.exports = {
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
];
},
};
set -euo pipefail
# Deploy PostHog self-hosted
git clone https://github.com/PostHog/posthog.git
cd posthog
docker compose -f docker-compose.hobby.yml up -d
# Your PostHog instance at http://localhost:8000
vercel env add NEXT_PUBLIC_POSTHOG_KEY production
vercel env add NEXT_PUBLIC_POSTHOG_HOST production
vercel env add POSTHOG_API_KEY production # Server-side key
vercel --prod
| Issue | Cause | Solution |
|---|---|---|
| Events not appearing | Wrong API key | Verify phc_ project key |
| Ad blocker blocking | Direct PostHog requests | Set up reverse proxy |
| Self-hosted slow | Under-provisioned | Increase Docker resources |
| Missing server events | Not flushing | Call posthog.flush() in serverless |
Basic usage: Apply posthog deploy integration to a standard project setup with default configuration options.
Advanced scenario: Customize posthog deploy integration for production environments with multiple constraints and team-specific requirements.
For webhook handling, see posthog-webhooks-events.