posthog-instrumentation

โดย posthog

ตรวจจับการวิเคราะห์ PostHog, การติดตามเหตุการณ์ และฟีเจอร์แฟล็กโดยอัตโนมัติในหลายเฟรมเวิร์ก รองรับ JavaScript/TypeScript, React, Python และ Node.js พร้อมรูปแบบการตั้งค่าเฉพาะเฟรมเวิร์ก ครอบคลุมความสามารถหลักสามประการ: การจับเหตุการณ์พร้อมคุณสมบัติที่กำหนดเอง, การประเมินฟีเจอร์แฟล็กสำหรับการเปิดตัวแบบค่อยเป็นค่อยไป และการระบุตัวผู้ใช้ ตรวจจับการกำหนดค่า PostHog ที่มีอยู่แล้วและเพิ่มการตรวจจับโดยไม่ทำซ้ำการตั้งค่า รวมถึงแนวทางปฏิบัติที่ดีที่สุดสำหรับการตั้งชื่อเหตุการณ์ คุณสมบัติ...

npx skills add https://github.com/posthog/posthog-for-claude --skill posthog-instrumentation

PostHog Instrumentation Skill

Help users add PostHog analytics, event tracking, and feature flags to their code.

When to Use

  • User asks to "add PostHog" or "add analytics"
  • User wants to track events or user actions
  • User needs to implement feature flags
  • User asks about instrumenting their code

Workflow

  1. Identify the framework (React, Next.js, Python, Node.js, etc.)
  2. Check for existing PostHog setup
  3. Add appropriate instrumentation

Code Patterns

JavaScript/TypeScript

// Event tracking
posthog.capture('button_clicked', { button_name: 'signup' })

// Feature flags
if (posthog.isFeatureEnabled('new-feature')) {
  // Show new feature
}

// User identification
posthog.identify(userId, { email: user.email })

Python

from posthog import Posthog
posthog = Posthog(api_key='<ph_project_api_key>')

# Event tracking
posthog.capture(distinct_id='user_123', event='purchase_completed')

# Feature flags
if posthog.feature_enabled('new-feature', 'user_123'):
    # Show new feature

React

import { usePostHog } from 'posthog-js/react'

function MyComponent() {
  const posthog = usePostHog()

  const handleClick = () => {
    posthog.capture('button_clicked')
  }
}

Best Practices

  • Use consistent event naming (snake_case recommended)
  • Include relevant properties with events
  • Identify users early in their session
  • Use feature flags for gradual rollouts

Skills เพิ่มเติมจาก posthog

error-tracking-go
posthog
การติดตามข้อผิดพลาดของ PostHog สำหรับ Go
official
integration-laravel
posthog
PostHog integration สำหรับแอปพลิเคชัน Laravel
official
integration-nextjs-app-router
posthog
PostHog integration สำหรับแอปพลิเคชัน Next.js App Router
official
logs-other
posthog
บันทึก PostHog สำหรับภาษาอื่น
official
logs-python
posthog
PostHog logs สำหรับ Python
official
analyzing-experiment-session-replays
posthog
วิเคราะห์รูปแบบการเล่นซ้ำเซสชันในรูปแบบการทดลองต่างๆ เพื่อทำความเข้าใจความแตกต่างของพฤติกรรมผู้ใช้ ใช้เมื่อผู้ใช้ต้องการดูว่าผู้ใช้โต้ตอบกับ...
official
auditing-experiments-flags
posthog
ตรวจสอบการทดลองและฟีเจอร์แฟล็กของ PostHog เพื่อหาปัญหาการกำหนดค่า ความล้าสมัย และการละเมิดแนวปฏิบัติที่ดีที่สุด อ่านเมื่อผู้ใช้ขอให้ตรวจสอบ ตรวจสอบสุขภาพ...
official
auditing-warehouse-data-health
posthog
ทักษะนี้สร้างการตรวจสอบทั่วทั้งโปรเจกต์ของไปป์ไลน์คลังข้อมูล ใช้เมื่อผู้ใช้ต้องการสรุปทุกอย่างที่เสียหาย ไม่ใช่การเจาะลึกในซิงก์เดียว การเจาะลึกความล้มเหลวแต่ละรายการคือ diagnosing-failed-warehouse-syncs ทักษะนี้คือการสแกนที่บอกให้พวกเขารู้ว่าควรมองหาที่ไหนก่อน
official