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,940 stars 439 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
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category