posthog-hello-world

Featured

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".

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 Hello World ## Overview Minimal working examples demonstrating the three core PostHog operations: capturing events, identifying users, and evaluating feature flags. Covers both browser (`posthog-js`) and server (`posthog-node`) SDKs. ## Prerequisites - Completed `posthog-install-auth` setup - Project API key (`phc_...`) configured - `posthog-js` and/or `posthog-node` installed ## Instructions ### Step 1: Capture Your First Event (Node.js) ```typescript // hello-posthog.ts import { PostHog } from 'posthog-node'; const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { host: 'https://us.i.posthog.com', }); async function main() { // 1. Capture a custom event posthog.capture({ distinctId: 'user-123', event: 'hello_posthog', properties: { greeting: 'Hello from posthog-node!', source: 'hello-world-skill', timestamp: new Date().toISOString(), }, }); console.log('Event captured: hello_posthog'); // 2. Identify a user with properties posthog.identify({ distinctId: 'user-123', properties: { email: 'dev@example.com', name: 'Dev User', plan: 'free', }, }); console.log('User identified: user-123'); // 3. Check a feature flag const flagValue = await posthog.getFeatureFlag('my-feature-flag', 'user-123'); console.log(`Feature flag "my-feature-flag": ${flagValue}`); // 4. Flush and shutdown (required in scripts/serverless) await posthog.shutdown(); console.log('Done ...

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-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-sdk-patterns

Production-ready PostHog SDK patterns: singleton client, typed events, React hooks, Next.js App Router integration, and Python patterns. Trigger: "posthog SDK patterns", "posthog best practices", "posthog React hook", "posthog Next.js", "posthog typescript".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-core-workflow-a

Implement PostHog product analytics: event capture, user identification, group analytics, and property management using posthog-js and posthog-node. Trigger: "posthog analytics", "capture events", "track users posthog", "posthog identify", "posthog group analytics", "product analytics".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-performance-tuning

Optimize PostHog performance: local flag evaluation, client batching config, event sampling, efficient HogQL queries, and serverless flush patterns. Trigger: "posthog performance", "optimize posthog", "posthog latency", "posthog caching", "posthog slow", "posthog batch", "posthog fast".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-install-auth

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".

2,266 Updated today
jeremylongshore