posthog-install-auth

Featured

Install and configure PostHog SDKs with authentication. Use when setting up posthog-js (browser), posthog-node (server), or configuring API keys for a new PostHog integration. Trigger: "install posthog", "setup posthog", "posthog auth", "configure posthog API key", "posthog init".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PostHog Install & Auth ## Overview Install PostHog SDKs and configure authentication. PostHog uses two key types: **Project API Key** (`phc_...`) for event capture (public, safe for frontend) and **Personal API Key** (`phx_...`) for private API endpoints (never expose to clients). ## Prerequisites - Node.js 20+ or Python 3.10+ - PostHog account at [app.posthog.com](https://app.posthog.com) - Project API key from Project Settings > Project API Key - Personal API key from Settings > Personal API Keys (for server-side admin) ## Instructions ### Step 1: Install the SDK ```bash set -euo pipefail # Browser SDK (posthog-js) npm install posthog-js # Node.js server SDK (posthog-node) npm install posthog-node # Python SDK pip install posthog ``` ### Step 2: Configure Environment Variables ```bash # .env (add to .gitignore — never commit) NEXT_PUBLIC_POSTHOG_KEY=phc_your_project_api_key # Safe for frontend POSTHOG_HOST=https://us.i.posthog.com # US Cloud (or eu.i.posthog.com) POSTHOG_PERSONAL_API_KEY=phx_your_personal_key # Server-only, never expose POSTHOG_PROJECT_ID=12345 # From project URL ``` ### Step 3: Initialize Browser SDK (posthog-js) ```typescript // lib/posthog.ts import posthog from 'posthog-js'; export function initPostHog() { if (typeof window === 'undefined') return; posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com', ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

posthog-security-basics

Secure PostHog integration: API key management, project key vs personal key separation, secret rotation, scoped keys, and git-leak prevention. Trigger: "posthog security", "posthog secrets", "secure posthog", "posthog API key security", "posthog key rotation".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-prod-checklist

Production readiness checklist for PostHog integrations: SDK configuration, graceful degradation, health checks, shutdown hooks, and rollback procedures. Trigger: "posthog production", "deploy posthog", "posthog go-live", "posthog launch checklist", "posthog production ready".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-common-errors

Diagnose and fix common PostHog errors: events not appearing, flags returning undefined, 401/429 errors, SDK initialization failures, and identity issues. Trigger: "posthog error", "fix posthog", "posthog not working", "debug posthog", "posthog events missing", "posthog broken".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-hello-world

Create a minimal working PostHog example with event capture, identify, and feature flags. Use when starting a new PostHog integration, testing your setup, or learning basic posthog-js and posthog-node patterns. Trigger: "posthog hello world", "posthog example", "posthog quick start", "simple posthog code", "first posthog event".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-multi-env-setup

Configure PostHog across development, staging, and production environments. Separate PostHog projects per environment, environment-specific SDK config, feature flag rollout per env, and session recording controls. Trigger: "posthog environments", "posthog staging", "posthog dev prod", "posthog environment setup", "posthog project per env".

2,266 Updated today
jeremylongshore