posthog-instrumentation
bởi posthog
Tự động thiết lập công cụ đo lường PostHog, theo dõi sự kiện và cờ tính năng trên nhiều framework. Hỗ trợ JavaScript/TypeScript, React, Python và Node.js với các mẫu thiết lập dành riêng cho từng framework. Bao gồm ba khả năng cốt lõi: thu thập sự kiện với thuộc tính tùy chỉnh, đánh giá cờ tính năng để triển khai dần dần và nhận dạng người dùng. Phát hiện cấu hình PostHog hiện có và thêm công cụ đo lường mà không trùng lặp thiết lập. Bao gồm các phương pháp tốt nhất cho quy ước đặt tên sự kiện, thuộc tính...
npx skills add https://github.com/posthog/posthog-for-claude --skill posthog-instrumentationPostHog 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
- Identify the framework (React, Next.js, Python, Node.js, etc.)
- Check for existing PostHog setup
- 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
Thêm skills từ posthog
error-tracking-go
posthog
Theo dõi lỗi PostHog cho Go
official
integration-laravel
posthog
Tích hợp PostHog cho ứng dụng Laravel
official
integration-nextjs-app-router
posthog
Tích hợp PostHog cho ứng dụng Next.js App Router
official
logs-other
posthog
Nhật ký PostHog cho các Ngôn ngữ Khác
official
logs-python
posthog
Nhật ký PostHog cho Python
official
analyzing-experiment-session-replays
posthog
Phân tích các mẫu phát lại phiên trên các biến thể thử nghiệm để hiểu sự khác biệt trong hành vi người dùng. Sử dụng khi người dùng muốn xem cách người dùng tương tác với…
official
auditing-experiments-flags
posthog
Kiểm tra các thí nghiệm PostHog và cờ tính năng để phát hiện vấn đề cấu hình, sự lỗi thời và vi phạm thực hành tốt nhất. Đọc khi người dùng yêu cầu kiểm tra, kiểm tra sức khỏe,…
official
auditing-warehouse-data-health
posthog
Kỹ năng này tạo ra một bản kiểm tra toàn dự án về đường ống kho dữ liệu. Sử dụng khi người dùng muốn tổng quan về mọi thứ bị hỏng, không phải đi sâu vào một đồng bộ cụ thể. Việc đi sâu vào từng lỗi riêng lẻ là diagnosing-failed-warehouse-syncs; kỹ năng này là bản quét cho họ biết nên xem trước ở đâu.
official